@@ -18,22 +18,46 @@ jobs:
1818 username : ${{ secrets.DOCKERHUB_USERNAME }}
1919 password : ${{ secrets.DOCKERHUB_TOKEN }}
2020
21- - name : Set up Docker Buildx
21+ - name : Set up Docker Buildx (cloud driver)
2222 uses : docker/setup-buildx-action@v3
2323 with :
24- version : " lab:latest"
24+ version : lab:latest
2525 driver : cloud
26- endpoint : " fontebasso/multiarch-builder"
26+ endpoint : fontebasso/multiarch-builder
2727
2828 - name : Extract release version
2929 id : version
3030 run : echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
3131
32- - name : Build and push
32+ - name : Build for amd64
3333 uses : docker/build-push-action@v6
3434 with :
3535 context : .
3636 tags : |
37- fontebasso/php-nginx:${{ env.RELEASE_VERSION }}
38- fontebasso/php-nginx:latest
39- platforms : linux/amd64,linux/arm64
37+ fontebasso/php-nginx:${{ env.RELEASE_VERSION }}-amd64
38+ platforms : linux/amd64
39+ push : true
40+
41+ - name : Build for arm64
42+ uses : docker/build-push-action@v6
43+ with :
44+ context : .
45+ tags : |
46+ fontebasso/php-nginx:${{ env.RELEASE_VERSION }}-arm64
47+ platforms : linux/arm64
48+ push : true
49+
50+ - name : Merge and push multi-arch
51+ run : |
52+ docker buildx imagetools create \
53+ --tag fontebasso/php-nginx:${{ env.RELEASE_VERSION }} \
54+ --tag fontebasso/php-nginx:latest \
55+ fontebasso/php-nginx:${{ env.RELEASE_VERSION }}-amd64 \
56+ fontebasso/php-nginx:${{ env.RELEASE_VERSION }}-arm64
57+
58+ - name : Clean up intermediate tags
59+ run : |
60+ docker logout
61+ echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
62+ docker rmi fontebasso/php-nginx:${{ env.RELEASE_VERSION }}-amd64 || true
63+ docker rmi fontebasso/php-nginx:${{ env.RELEASE_VERSION }}-arm64 || true
0 commit comments