1- # See https://docs.docker.com/build/ci/github-actions/multi-platform/ for docs
2-
31name : Create multi-platform container image
42
53on :
@@ -48,21 +46,16 @@ jobs:
4846 username : ${{ github.actor }}
4947 password : ${{ secrets.GITHUB_TOKEN }}
5048
51- - name : Docker meta
52- id : meta
53- uses : docker/metadata-action@v5
54- with :
55- images : ${{ env.REGISTRY_IMAGE }}
56- tags : ${{ inputs.version-tag }}
57-
5849 - name : Build and push by digest
5950 id : build
6051 uses : docker/build-push-action@v6
6152 with :
6253 context : .
6354 platforms : ${{ matrix.platform }}
64- labels : ${{ steps.meta.outputs.labels }}
6555 outputs : type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
56+ tags : ${{ env.REGISTRY_IMAGE }}:${{ inputs.version-tag }}-${{ matrix.arch }}
57+ cache-from : type=gha
58+ cache-to : type=gha,mode=max
6659
6760 - name : Export digest
6861 run : |
@@ -73,44 +66,36 @@ jobs:
7366 - name : Upload digest
7467 uses : actions/upload-artifact@v4
7568 with :
76- name : digests-${{ env.PLATFORM_PAIR }}
69+ name : digests-${{ env.PLATFORM_PAIR }}-${{ inputs.version-tag }}
7770 path : /tmp/digests/*
7871 if-no-files-found : error
7972 retention-days : 1
8073
8174 merge :
8275 runs-on : ubuntu-latest
83- needs :
84- - build
76+ needs : build
8577 steps :
8678 - name : Download digests
8779 uses : actions/download-artifact@v4
8880 with :
8981 path : /tmp/digests
90- pattern : digests-*
82+ pattern : digests-*-${{ inputs.version-tag }}
9183 merge-multiple : true
9284
93- - name : Set up Docker Buildx
94- uses : docker/setup-buildx-action@v3
85+ - uses : docker/setup-buildx-action@v3
9586
9687 - uses : docker/login-action@v3
9788 with :
9889 registry : ghcr.io
9990 username : ${{ github.actor }}
10091 password : ${{ secrets.GITHUB_TOKEN }}
10192
102- - name : Docker meta
103- id : meta
104- uses : docker/metadata-action@v5
105- with :
106- images : ${{ env.REGISTRY_IMAGE }}
107- tags : ${{ inputs.version-tag }}
108-
10993 - name : Create manifest list and push
11094 working-directory : /tmp/digests
11195 run : |
112- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
96+ docker buildx imagetools create \
97+ -t ${{ env.REGISTRY_IMAGE }}:${{ inputs.version-tag }} \
11398 $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
11499
115100 - name : Inspect image
116- run : docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs. version }}
101+ run : docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ inputs. version-tag }}
0 commit comments