Skip to content

CI: build docker image for Linux ARM build and cache layers #6922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Build compiler binaries
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
with:
args: opam exec -- dune build --display quiet --profile static
context: ./docker
tags: rescript-ci-build:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build compiler binaries
run: docker run --rm -v ${{ github.workspace }}:/data -w /data rescript-ci-build:latest opam exec -- dune build --display quiet --profile static

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

- name: Use Node.js
uses: actions/setup-node@v4
Expand Down
15 changes: 15 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3.20
LABEL org.opencontainers.image.authors="Christoph Knittel <[email protected]>"
LABEL org.opencontainers.image.description="Alpine-based Docker image for building statically linked ReScript binaries."

# - gcompat needed for ARM64, see https://github.com/actions/runner/issues/801#issuecomment-1374967227
# - python3 needed for ninja build
RUN apk add --no-cache bash gcc g++ git make opam python3 rsync gcompat

# We need to specify the OPAM dir explicitly as the GitHub Actions runner
# will set a different home directory when running in a container.
ENV OPAMROOT=/root/.opam

RUN opam init -y --compiler=5.2.0 --disable-sandboxing

RUN opam install -y dune cppo=1.6.9 ounit2=2.2.7
Loading