refactor: Update Docker build workflow to use lowercase image names for multi-arch support

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-12-13 15:49:50 -08:00
parent e379092b6b
commit 5b4683d4a7

View file

@ -114,10 +114,16 @@ jobs:
contents: read contents: read
outputs: outputs:
digest: ${{ steps.build.outputs.digest }} digest: ${{ steps.build.outputs.digest }}
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/surfsense
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set lowercase image name
id: image
run: echo "name=${REGISTRY_IMAGE,,}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@ -143,7 +149,7 @@ jobs:
context: . context: .
file: ./Dockerfile.allinone file: ./Dockerfile.allinone
push: true push: true
tags: ghcr.io/${{ github.repository_owner }}/surfsense:${{ needs.tag_release.outputs.new_tag }}-amd64 tags: ${{ steps.image.outputs.name }}:${{ needs.tag_release.outputs.new_tag }}-amd64
platforms: linux/amd64 platforms: linux/amd64
cache-from: type=gha,scope=amd64 cache-from: type=gha,scope=amd64
cache-to: type=gha,mode=max,scope=amd64 cache-to: type=gha,mode=max,scope=amd64
@ -158,10 +164,16 @@ jobs:
contents: read contents: read
outputs: outputs:
digest: ${{ steps.build.outputs.digest }} digest: ${{ steps.build.outputs.digest }}
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/surfsense
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set lowercase image name
id: image
run: echo "name=${REGISTRY_IMAGE,,}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@ -187,7 +199,7 @@ jobs:
context: . context: .
file: ./Dockerfile.allinone file: ./Dockerfile.allinone
push: true push: true
tags: ghcr.io/${{ github.repository_owner }}/surfsense:${{ needs.tag_release.outputs.new_tag }}-arm64 tags: ${{ steps.image.outputs.name }}:${{ needs.tag_release.outputs.new_tag }}-arm64
platforms: linux/arm64 platforms: linux/arm64
cache-from: type=gha,scope=arm64 cache-from: type=gha,scope=arm64
cache-to: type=gha,mode=max,scope=arm64 cache-to: type=gha,mode=max,scope=arm64
@ -200,7 +212,13 @@ jobs:
permissions: permissions:
packages: write packages: write
contents: read contents: read
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/surfsense
steps: steps:
- name: Set lowercase image name
id: image
run: echo "name=${REGISTRY_IMAGE,,}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@ -211,7 +229,7 @@ jobs:
- name: Create and push multi-arch manifest - name: Create and push multi-arch manifest
run: | run: |
VERSION_TAG="${{ needs.tag_release.outputs.new_tag }}" VERSION_TAG="${{ needs.tag_release.outputs.new_tag }}"
IMAGE="ghcr.io/${{ github.repository_owner }}/surfsense" IMAGE="${{ steps.image.outputs.name }}"
# Create manifest for version tag # Create manifest for version tag
docker manifest create ${IMAGE}:${VERSION_TAG} \ docker manifest create ${IMAGE}:${VERSION_TAG} \
@ -235,5 +253,5 @@ jobs:
# Note: GHCR doesn't support tag deletion via API easily # Note: GHCR doesn't support tag deletion via API easily
# The arch-specific tags will remain but users should use the main tags # The arch-specific tags will remain but users should use the main tags
echo "Multi-arch manifest created successfully!" echo "Multi-arch manifest created successfully!"
echo "Users should pull: ghcr.io/${{ github.repository_owner }}/surfsense:${{ needs.tag_release.outputs.new_tag }}" echo "Users should pull: ${{ steps.image.outputs.name }}:${{ needs.tag_release.outputs.new_tag }}"
echo "Or for latest: ghcr.io/${{ github.repository_owner }}/surfsense:latest" echo "Or for latest: ${{ steps.image.outputs.name }}:latest"