Skip to content

Publish Multi-Arch Container Images #6

Publish Multi-Arch Container Images

Publish Multi-Arch Container Images #6

name: Publish Multi-Arch Container Images
on:
push:
branches:
- main
paths:
- 'Containerfile'
- 'Containerfile.full'
- 'docker-entrypoint.sh'
- '.github/workflows/publish-multiarch.yml'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_DEV: ghcr.io/gherlein/localdev
IMAGE_FULL: ghcr.io/gherlein/localfull
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- image: localdev
dockerfile: Containerfile
- image: localfull
dockerfile: Containerfile.full
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/gherlein/${{ matrix.image }}
tags: |
type=raw,value=latest
type=sha,prefix={{branch}}-
- name: Build and push multi-arch image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max