Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Publish Multi-Arch on Release | |
| # Trigger the workflow only when a new release is published | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push-multiarch: | |
| name: Build and Push Multi-Arch Docker Images | |
| runs-on: ubuntu-latest | |
| # Grant permissions for the GITHUB_TOKEN to push to GHCR | |
| permissions: | |
| contents: read # Needed to check out the code | |
| packages: write # Needed to push packages to GHCR | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Set up QEMU for multi-platform build emulation | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # Installs QEMU static binaries for emulating other architectures | |
| # No specific 'with' options usually needed for common platforms | |
| # Set up Docker Buildx for advanced build capabilities | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Creates a Buildx builder instance | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Log in to GitHub Container Registry (GHCR) | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable=${{ !github.event.release.prerelease }} | |
| - name: Build and push Multi-Arch Docker image | |
| id: build-and-push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| # Specify the platforms to build for | |
| platforms: linux/amd64,linux/arm64 | |
| push: true # Push the multi-arch manifest list | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # Cache settings remain beneficial | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |