Build ARM docker image in GitHub Actions using QEMU (#400)

This PR updates the GH Action docker workflow to crossbuild the docker
image for ARM using QEMU.
This theoratically works but takes about for a clean build 2.5 hours,
which may or may not be tolerable for each commit on `main`.
A action run where the dependencies are already cached needs about 15
minutes with this PR.
This commit is contained in:
Daniel 2022-05-09 22:09:31 +02:00 committed by GitHub
parent 1d030b9d32
commit 301190e427
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -19,6 +19,9 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
@ -51,6 +54,7 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -6,6 +6,10 @@ COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
# Ensure working C compile setup (not installed by default in arm64 images)
RUN apt update && apt install build-essential -y
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json