Skip to content

Build Docker Image

Build Docker Image #7

name: Build Docker Image
# This workflow MUST run on ARM64 architecture to properly build the ARM-based Docker image.
# The 'runs-on: ubuntu-latest-arm64' ensures GitHub Actions uses an ARM64 runner.
# The architecture is verified at the start of the workflow to prevent build issues.
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
steps:
- name: Verify ARM64 Architecture
run: |
set -euo pipefail
ARCH=$(uname -m)
echo "Current architecture: $ARCH"
case "$ARCH" in
aarch64|arm64)
echo "✓ Verified: Running on ARM64 architecture ($ARCH)"
;;
*)
echo "ERROR: This workflow must run on ARM64 architecture, but detected: $ARCH"
echo "Please ensure the runner is configured correctly (runs-on: ubuntu-latest-arm64)"
exit 1
;;
esac
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm64
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64