Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Create and publish the Docker image

on:
push:
branches:
- master
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
strategy:
fail-fast: false
matrix:
include:
- id: amd64
platform: linux/amd64
runner: ubuntu-latest
qemu: false
- id: arm64
platform: linux/arm64
runner: ubuntu-24.04-arm
qemu: false
- id: armv7
platform: linux/arm/v7
runner: ubuntu-latest
qemu: true
- id: armv6
platform: linux/arm/v6
runner: ubuntu-latest
qemu: true
- id: i386
platform: linux/386
runner: ubuntu-latest
qemu: true
- id: ppc64le
platform: linux/ppc64le
runner: ubuntu-latest
qemu: true
- id: s390x
platform: linux/s390x
runner: ubuntu-latest
qemu: true
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2

- name: Set up QEMU
if: matrix.qemu
uses: docker/setup-qemu-action@v4.1.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4.1.0

- name: Log in to the Container registry
uses: docker/login-action@v4.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v7.2.0
with:
context: .
push: true
platforms: ${{ matrix.platform }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-${{ matrix.id }}
cache-from: type=gha,scope=${{ matrix.id }}
cache-to: type=gha,mode=max,scope=${{ matrix.id }}

merge-manifests:
runs-on: ubuntu-latest
needs: build-and-push-image
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2

- name: Log in to the Container registry
uses: docker/login-action@v4.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6.1.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Create and push multi-arch manifests
shell: bash
run: |
set -euo pipefail

tags=()
while IFS= read -r tag; do
tags+=("-t" "$tag")
done <<< "${{ steps.meta.outputs.tags }}"

docker buildx imagetools create \
"${tags[@]}" \
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-amd64" \
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-arm64" \
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-armv7" \
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-armv6" \
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-i386" \
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-ppc64le" \
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-s390x"

- name: Verify published manifests include all platforms
shell: bash
run: |
set -euo pipefail

mapfile -t publish_tags < <(printf '%s\n' "${{ steps.meta.outputs.tags }}" | sed '/^[[:space:]]*$/d')
required_platforms=(
"linux/amd64"
"linux/arm64"
"linux/arm/v7"
"linux/arm/v6"
"linux/386"
"linux/ppc64le"
"linux/s390x"
)

for tag in "${publish_tags[@]}"; do
inspect="$(docker buildx imagetools inspect "$tag")"

for platform in "${required_platforms[@]}"; do
if ! grep -q "$platform" <<< "$inspect"; then
echo "Missing platform $platform in $tag"
exit 1
fi
done
done
87 changes: 0 additions & 87 deletions .github/workflows/on-push-branch.yml

This file was deleted.

74 changes: 0 additions & 74 deletions .github/workflows/on-push-master.yml

This file was deleted.

68 changes: 0 additions & 68 deletions .github/workflows/on-tag.yml

This file was deleted.

Loading