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