2020 strategy :
2121 fail-fast : false
2222 matrix :
23- runner :
24- - ubuntu-24.04
25- - ubuntu-24.04-arm
23+ include :
24+ - platform : linux/amd64
25+ runner : ubuntu-24.04
26+ - platform : linux/arm64
27+ runner : ubuntu-24.04-arm
2628 steps :
2729 - name : Checkout code
2830 uses : actions/checkout@v4
6668 name : Build/push the arch-specific image
6769 uses : docker/build-push-action@v6
6870 with :
71+ platforms : ${{ matrix.platform }}
6972 build-args : |
7073 BUILD_TIMESTAMP=${{ github.event.repository.updated_at }}
7174 BUILD_URL=${{ steps.set_build_url.outputs.build_url }}
@@ -86,14 +89,16 @@ jobs:
8689 echo "image-${RUNNER_ARCH,,}=${{ steps.get-registry.outputs.registry }}@${{ steps.build.outputs.digest }}" | tee -a "$GITHUB_OUTPUT"
8790
8891 merge :
89- runs-on : ubuntu-24.04
92+ runs-on : ubuntu-latest
9093 needs :
9194 - build
9295 env :
9396 DOCKER_APP_IMAGE_ARM64 : ${{ needs.build.outputs.build-image-arm }}
9497 DOCKER_APP_IMAGE_X64 : ${{ needs.build.outputs.build-image-x64 }}
9598 outputs :
9699 build-image : ${{ steps.meta.outputs.tags }}
100+ build-image-arm : ${{ needs.build.outputs.build-image-arm }}
101+ build-image-x64 : ${{ needs.build.outputs.build-image-x64 }}
97102 steps :
98103 - name : Checkout code
99104 uses : actions/checkout@v4
@@ -123,7 +128,7 @@ jobs:
123128 "$DOCKER_APP_IMAGE_ARM64" "$DOCKER_APP_IMAGE_X64"
124129
125130 test :
126- runs-on : ubuntu-24.04
131+ runs-on : ubuntu-latest
127132 needs :
128133 - merge
129134 env :
@@ -152,16 +157,21 @@ jobs:
152157 docker compose exec app bin/test
153158
154159 push :
155- runs-on : ubuntu-24.04
160+ runs-on : ubuntu-latest
156161 needs :
157162 - merge
158163 - test
159164 env :
160165 DOCKER_APP_IMAGE : ${{ needs.merge.outputs.build-image }}
166+ DOCKER_APP_IMAGE_ARM64 : ${{ needs.merge.outputs.build-image-arm }}
167+ DOCKER_APP_IMAGE_X64 : ${{ needs.merge.outputs.build-image-x64 }}
161168 steps :
162169 - name : Checkout code
163170 uses : actions/checkout@v4
164171
172+ - name : Set up Docker Buildx
173+ uses : docker/setup-buildx-action@v3
174+
165175 - name : Login to GitHub Container Registry
166176 uses : docker/login-action@v3
167177 with :
@@ -181,6 +191,5 @@ jobs:
181191
182192 - name : Retag and push the image
183193 run : |
184- docker pull "$DOCKER_APP_IMAGE"
185- echo "$DOCKER_METADATA_OUTPUT_TAGS" | tr ' ' '\n' | xargs -n1 docker tag "$DOCKER_APP_IMAGE"
186- docker push --all-tags "$(echo "$DOCKER_APP_IMAGE" | cut -f1 -d:)"
194+ docker buildx imagetools create \
195+ $(jq -cr '.tags | map("--tag " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $DOCKER_APP_IMAGE_ARM64 $DOCKER_APP_IMAGE_X64
0 commit comments