Skip to content

Commit cf3d361

Browse files
committed
Update Docker tags in GitHub Actions workflow for multi-architecture support
- Modified Docker image tags to include architecture suffixes (amd64 and arm64) for better clarity and differentiation. - Adjusted manifest creation commands to reference the updated tags, ensuring accurate multi-architecture image handling. - Enhanced versioning by appending architecture to version-specific tags.
1 parent e5c3e71 commit cf3d361

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

.github/workflows/docker-publish.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ jobs:
3737
with:
3838
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3939
tags: |
40-
type=raw,value=latest,enable={{is_default_branch}}
41-
type=ref,event=branch
42-
type=ref,event=pr
43-
type=semver,pattern={{version}}
44-
type=semver,pattern={{major}}.{{minor}}
45-
type=sha
40+
type=raw,value=amd64,enable={{is_default_branch}}
41+
type=ref,event=branch,suffix=-amd64
42+
type=ref,event=pr,suffix=-amd64
43+
type=semver,pattern={{version}}-amd64
44+
type=semver,pattern={{major}}.{{minor}}-amd64
45+
type=sha,suffix=-amd64
4646
4747
- name: Build and push Docker image
4848
uses: docker/build-push-action@v5
@@ -82,7 +82,7 @@ jobs:
8282
with:
8383
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
8484
tags: |
85-
type=raw,value=latest-arm64,enable={{is_default_branch}}
85+
type=raw,value=arm64,enable={{is_default_branch}}
8686
type=ref,event=branch,suffix=-arm64
8787
type=ref,event=pr,suffix=-arm64
8888
type=semver,pattern={{version}}-arm64
@@ -131,11 +131,10 @@ jobs:
131131
132132
# For main branch or latest tag
133133
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
134-
# Create a manifest using docker CLI commands
135-
docker manifest rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest || true
134+
# Create a manifest for latest
136135
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
137-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
138-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-arm64
136+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:amd64 \
137+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:arm64
139138
140139
# Push the manifest
141140
docker manifest push --purge ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
@@ -146,19 +145,17 @@ jobs:
146145
VERSION=${GITHUB_REF#refs/tags/v}
147146
148147
# Create version tag manifest
149-
docker manifest rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} || true
150148
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
151-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
149+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-amd64 \
152150
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-arm64
153151
154152
# Push the manifest
155153
docker manifest push --purge ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
156154
157155
# Create major.minor tag manifest
158156
MAJOR_MINOR=$(echo ${VERSION} | cut -d. -f1,2)
159-
docker manifest rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${MAJOR_MINOR} || true
160157
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${MAJOR_MINOR} \
161-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
158+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-amd64 \
162159
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-arm64
163160
164161
# Push the manifest

0 commit comments

Comments
 (0)