Skip to content

Latest commit

 

History

History

docker-multiarch-build-push

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

docker-multiarch-build-push GitHub Action

This GitHub Action builds, scans and (optionally) pushes a multi-architecture Docker image using Docker buildx and QEMU.

It also makes use of the GitHub Actions cache to preserve the Docker build cache between runs.

See the action.yml for more information.

Usage

The following job uses this action to build and push a multi-architecture image to GitHub Packages with some standard tags (short-sha and branch name for all commits; tag if ref is a tag):

build_push_image:
  name: Build and push image
  runs-on: ubuntu-latest
  steps:
    - name: Check out the repository
      uses: actions/checkout@v4

    - name: Login to GitHub Container Registry
      uses: docker/login-action@v3
      with:
        registry: ghcr.io
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}

    - name: Calculate metadata for image
      id: image-meta
      uses: docker/metadata-action@v5
      with:
        images: ghcr.io/my-org/my-image
        # Produce the branch name or tag and the SHA as tags
        tags: |
          type=ref,event=branch
          type=ref,event=tag
          type=sha,prefix=

    - name: Build and push image
      uses: azimuth-cloud/github-actions/docker-multiarch-build-push@master
      with:
        cache-key: my-image
        context: .
        platforms: linux/amd64,linux/arm64
        push: true
        tags: ${{ steps.image-meta.outputs.tags }}
        labels: ${{ steps.image-meta.outputs.labels }}