1616 JULIA_VERSION : " 1.11.9"
1717
1818jobs :
19- build-and-push :
20- runs-on : ubuntu-latest
19+ build :
20+ strategy :
21+ fail-fast : false
22+ matrix :
23+ include :
24+ - platform : linux/amd64
25+ runner : ubuntu-latest
26+ suffix : amd64
27+ - platform : linux/arm64
28+ runner : ubuntu-24.04-arm
29+ suffix : arm64
30+ runs-on : ${{ matrix.runner }}
2131
2232 steps :
2333 - name : Checkout
@@ -30,30 +40,25 @@ jobs:
3040 username : ${{ github.actor }}
3141 password : ${{ secrets.CR_PAT }}
3242
33- - name : Set up QEMU (for multi-arch builds)
34- uses : docker/setup-qemu-action@v3
35-
3643 - name : Set up Docker Buildx
3744 uses : docker/setup-buildx-action@v3
3845
39- - name : Build and push
46+ - name : Build and push (${{ matrix.suffix }})
4047 id : build
4148 uses : docker/build-push-action@v6
4249 with :
4350 context : .
4451 file : .devcontainer/Dockerfile
45- platforms : linux/amd64,linux/arm64
52+ platforms : ${{ matrix.platform }}
4653 push : true
4754 build-args : JULIA_VERSION=${{ env.JULIA_VERSION }}
48- tags : |
49- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}
50- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
51- # cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
52- cache-to : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
55+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}-${{ matrix.suffix }}
56+ cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.suffix }}
57+ cache-to : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.suffix }},mode=max
5358
5459 - name : Smoke test — cached packages load without recompiling
5560 run : |
56- IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@ ${{ steps.build.outputs.digest }}"
61+ IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}: ${{ env.JULIA_VERSION }}-${{ matrix.suffix }}"
5762 docker pull "$IMAGE"
5863 docker run --rm "$IMAGE" julia -e '
5964 t_plots = @elapsed using Plots
@@ -66,11 +71,33 @@ jobs:
6671 t_ode < 30 || error("using OrdinaryDiffEq too slow ($(t_ode)s) — cache miss?")
6772 '
6873
74+ manifest :
75+ needs : build
76+ runs-on : ubuntu-latest
77+
78+ steps :
79+ - name : Log in to GHCR
80+ uses : docker/login-action@v3
81+ with :
82+ registry : ${{ env.REGISTRY }}
83+ username : ${{ github.actor }}
84+ password : ${{ secrets.CR_PAT }}
85+
86+ - name : Create multi-arch manifest
87+ run : |
88+ for TAG in ${{ env.JULIA_VERSION }} latest; do
89+ docker buildx imagetools create \
90+ --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$TAG \
91+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}-amd64 \
92+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}-arm64
93+ done
94+ docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}
95+
6996 - name : Report image digest
70- if : always() && steps.build.outputs.digest != ''
7197 run : |
72- DIGEST='${{ steps.build.outputs.digest }}'
73- REF="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}@${DIGEST}"
98+ REF_BASE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}"
99+ DIGEST=$(docker buildx imagetools inspect "$REF_BASE" | awk '/^Digest:/ {print $2; exit}')
100+ REF="${REF_BASE}@${DIGEST}"
74101 echo "::notice title=New image digest::${REF}"
75102 {
76103 echo "## New image pushed"
0 commit comments