Fix Docker build workflow to correctly reference architecture in image tags and clean up comments for clarity

This commit is contained in:
Arunavo Ray
2025-05-19 10:30:27 +05:30
parent 6e54b130eb
commit 8125331b3b

View File

@@ -11,9 +11,8 @@ env:
IMAGE: ${{ github.repository }}
jobs:
# Build platform-specific images in parallel
build:
name: Build ${{ matrix.platform }}
name: Build ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
@@ -25,7 +24,6 @@ jobs:
platform: linux/arm64
runner: ubuntu-24.04-arm
permissions:
contents: read
packages: write
@@ -52,11 +50,11 @@ jobs:
context: .
platforms: ${{ matrix.platform }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ matrix.platform-suffix }}-${{ github.sha }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ matrix.arch }}-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Create and push the multi-platform manifest
manifest:
name: Create and Push Manifest
runs-on: ubuntu-latest
@@ -80,7 +78,6 @@ jobs:
- name: Create and push manifest
run: |
# Create and push the manifest with both architectures
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest \
${{ env.REGISTRY }}/${{ env.IMAGE }}:amd64-${{ github.sha }} \
${{ env.REGISTRY }}/${{ env.IMAGE }}:arm64-${{ github.sha }}
@@ -89,6 +86,5 @@ jobs:
${{ env.REGISTRY }}/${{ env.IMAGE }}:amd64-${{ github.sha }} \
${{ env.REGISTRY }}/${{ env.IMAGE }}:arm64-${{ github.sha }}
# Push the manifests
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}