Skip to content

Commit abfa35a

Browse files
committed
Avoid platform-specific image tags by using digests in Docker manifest
Replaces per-architecture tags (e.g., *-amd64, *-arm64) with direct digest references when creating the multi-arch Docker manifest. This reduces tag clutter in the registry.
1 parent 13a0b18 commit abfa35a

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

.github/workflows/BuildDockerDeeploy.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
name: Build Deploy Image
3737
needs: [ prepare ]
3838
runs-on: ${{ matrix.runner }}
39+
outputs:
40+
digest-amd64: ${{ steps.digest.outputs.digest-amd64 }}
41+
digest-arm64: ${{ steps.digest.outputs.digest-arm64 }}
3942
strategy:
4043
fail-fast: false
4144
matrix:
@@ -89,6 +92,7 @@ jobs:
8992
OWNER: '${{ github.repository_owner }}'
9093

9194
- name: Build and push final deploy image
95+
id: build
9296
uses: docker/build-push-action@v6
9397
with:
9498
platforms: linux/${{ matrix.platform }}
@@ -99,9 +103,11 @@ jobs:
99103
push: true
100104
build-args: |
101105
BASE_IMAGE=${{ github.event.inputs.docker_image_toolchain }}
102-
tags: |
103-
ghcr.io/${{ env.OWNER_LC }}/deeploy:latest-${{ matrix.platform }}
104-
ghcr.io/${{ env.OWNER_LC }}/deeploy:${{ needs.prepare.outputs.docker_tag }}-${{ matrix.platform }}
106+
outputs: type=image,name=ghcr.io/${{ env.OWNER_LC }}/deeploy,annotation-index=true,name-canonical=true,push=true
107+
108+
- name: Extract image digest
109+
id: digest
110+
run: echo "digest-${{ matrix.platform }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
105111

106112
merge-deeploy-images:
107113
name: Merge Deeploy Images
@@ -121,8 +127,13 @@ jobs:
121127
env:
122128
OWNER: '${{ github.repository_owner }}'
123129

124-
- uses: Noelware/docker-manifest-action@v1
130+
- name: Merge Deeploy Images
131+
uses: Noelware/docker-manifest-action@v1
125132
with:
126-
inputs: ghcr.io/${{ env.OWNER_LC }}/deeploy:latest-amd64,ghcr.io/${{ env.OWNER_LC }}/deeploy:latest-arm64
127-
tags: ghcr.io/${{ env.OWNER_LC }}/deeploy:latest,ghcr.io/${{ env.OWNER_LC }}/deeploy:${{ needs.prepare.outputs.docker_tag }}
133+
inputs: |
134+
ghcr.io/${{ env.OWNER_LC }}/deeploy@${{ needs.build-deeploy.outputs.digest-amd64 }},
135+
ghcr.io/${{ env.OWNER_LC }}/deeploy@${{ needs.build-deeploy.outputs.digest-arm64 }}
136+
tags: |
137+
ghcr.io/${{ env.OWNER_LC }}/deeploy:latest,
138+
ghcr.io/${{ env.OWNER_LC }}/deeploy:${{ needs.prepare.outputs.docker_tag }}
128139
push: true

.github/workflows/BuildDockerToolchain.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
name: Build Deeploy Toolchain Image
3232
needs: [ prepare ]
3333
runs-on: ${{ matrix.runner }}
34+
outputs:
35+
digest-amd64: ${{ steps.digest.outputs.digest-amd64 }}
36+
digest-arm64: ${{ steps.digest.outputs.digest-arm64 }}
3437
strategy:
3538
fail-fast: false
3639
matrix:
@@ -83,15 +86,18 @@ jobs:
8386
OWNER: '${{ github.repository_owner }}'
8487

8588
- name: Build and push toolchain image
89+
id: build
8690
uses: docker/build-push-action@v6
8791
with:
8892
platforms: linux/${{ matrix.platform }}
8993
context: .
9094
file: Container/Dockerfile.toolchain
9195
push: true
92-
tags: |
93-
ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:latest-${{ matrix.platform }}
94-
ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:${{ needs.prepare.outputs.docker_tag }}-${{ matrix.platform }}
96+
outputs: type=image,name=ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain,annotation-index=true,name-canonical=true,push=true
97+
98+
- name: Extract image digest
99+
id: digest
100+
run: echo "digest-${{ matrix.platform }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
95101

96102
merge-toolchain-images:
97103
name: Merge Deeploy Toolchain Images
@@ -111,8 +117,13 @@ jobs:
111117
env:
112118
OWNER: '${{ github.repository_owner }}'
113119

114-
- uses: Noelware/docker-manifest-action@v1
120+
- name: Merge Toolchain Images
121+
uses: Noelware/docker-manifest-action@v1
115122
with:
116-
inputs: ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:latest-amd64,ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:latest-arm64
117-
tags: ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:latest,ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:${{ needs.prepare.outputs.docker_tag }}
123+
inputs: |
124+
ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain@${{ needs.build-toolchain.outputs.digest-amd64 }},
125+
ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain@${{ needs.build-toolchain.outputs.digest-arm64 }}
126+
tags: |
127+
ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:latest,
128+
ghcr.io/${{ env.OWNER_LC }}/deeploy-toolchain:${{ needs.prepare.outputs.docker_tag }}
118129
push: true

0 commit comments

Comments
 (0)