Skip to content

Commit ca59cbe

Browse files
committed
CI: build docker image for Linux ARM build and cache layers
1 parent 53d2d82 commit ca59cbe

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

.github/workflows/ci.yml

+14-6
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,23 @@ jobs:
103103
- name: Checkout
104104
uses: actions/checkout@v4
105105

106-
- name: Build compiler binaries
107-
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01
106+
- name: Setup Docker buildx
107+
uses: docker/setup-buildx-action@v3
108+
109+
- name: Build Docker image
110+
uses: docker/build-push-action@v6
108111
with:
109-
args: opam exec -- dune build --display quiet --profile static
112+
context: ./docker
113+
tags: rescript-ci-build:latest
114+
load: true
115+
cache-from: type=gha
116+
cache-to: type=gha,mode=max
117+
118+
- name: Build compiler binaries
119+
run: docker run --rm -v ${{ github.workspace }}:/data -w /data rescript-ci-build:latest opam exec -- dune build --display quiet --profile static
110120

111121
- name: Build ninja binary
112-
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01
113-
with:
114-
args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap"
122+
run: docker run --rm -v ${{ github.workspace }}:/data -w /data/ninja -e LDFLAGS="-static" rescript-ci-build:latest python configure.py --bootstrap
115123

116124
- name: Use Node.js
117125
uses: actions/setup-node@v4

docker/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM alpine:3.20
2+
LABEL org.opencontainers.image.authors="Christoph Knittel <[email protected]>"
3+
LABEL org.opencontainers.image.description="Alpine-based Docker image for building statically linked ReScript binaries."
4+
5+
# - gcompat needed for ARM64, see https://github.com/actions/runner/issues/801#issuecomment-1374967227
6+
# - python3 needed for ninja build
7+
RUN apk add --no-cache bash gcc g++ git make opam python3 rsync gcompat
8+
9+
# We need to specify the OPAM dir explicitly as the GitHub Actions runner
10+
# will set a different home directory when running in a container.
11+
ENV OPAMROOT=/root/.opam
12+
13+
RUN opam init -y --compiler=5.2.0 --disable-sandboxing
14+
15+
RUN opam install -y dune cppo=1.6.9 ounit2=2.2.7

0 commit comments

Comments
 (0)