Update docker-build-multiarch.yml

This commit is contained in:
2025-10-31 21:33:21 -07:00
parent 21aa70b37b
commit 47ffccecd8
2 changed files with 38 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ env:
jobs:
build-and-push:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
@@ -20,11 +20,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
run: |
docker buildx create --name multi --use
docker buildx inspect --bootstrap
- name: Set up QEMU (for cross-compiling)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
cleanup: true
# Login to your Gitea registry
- name: Log in to registry
uses: docker/login-action@v3
with:
@@ -32,13 +37,32 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build Docker image
run: |
docker buildx build \
--platform ${{ env.PLATFORMS }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }} \
--push --progress=plain .
# Optional: derive tags/labels from repo metadata
# Comment out if you prefer static tags only
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ env.TAG_NAME }}
type=raw,value=sha-${{ github.sha }}
flavor: |
latest=false
- name: Build and push (multi-arch)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Optional: print the final manifest list for verification
- name: Inspect pushed manifest
run: |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}