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:
parent
1d030b9d32
commit
301190e427
2 changed files with 8 additions and 0 deletions
4
.github/workflows/docker.yaml
vendored
4
.github/workflows/docker.yaml
vendored
|
@ -19,6 +19,9 @@ jobs:
|
||||||
- name: Check Out Repo
|
- name: Check Out Repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v3
|
uses: docker/metadata-action@v3
|
||||||
|
@ -51,6 +54,7 @@ jobs:
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ COPY . .
|
||||||
RUN cargo chef prepare --recipe-path recipe.json
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
FROM chef AS builder
|
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
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue