Files
generic-docker-images/.gitea/workflows/buildpublish.yaml
Your Name 943172e8e0
All checks were successful
Build-Publish-Multi-Arch / build (linux/amd64) (push) Successful in 11s
Build-Publish-Multi-Arch / build (linux/arm64) (push) Successful in 12s
Build-Publish-Multi-Arch / create-manifest (push) Successful in 15s
Fix manifest list creation for multi-arch images
- Remove existing manifests before creating new ones
- Add architecture annotations for proper platform detection
- Ensures Docker pulls correct architecture automatically
2025-09-21 15:37:33 +12:00

93 lines
2.9 KiB
YAML

name: Build-Publish-Multi-Arch
run-name: Build and publish multi-architecture Docker images
on: [push]
defaults:
run:
shell: bash
jobs:
build:
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Gitea
uses: docker/login-action@v3
with:
registry: gitea.jde.nz
username: DoesntMatter
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
- name: Build Images
run: |
./build.sh
- name: Publish as Architecture-Specific
run: |
# Only publish on main branch
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
DOCKER_PUSH_TOKEN=${{ secrets.DOCKER_PUSH_TOKEN }} \
./publish.sh
fi
create-manifest:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Gitea
uses: docker/login-action@v3
with:
registry: gitea.jde.nz
username: DoesntMatter
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Create and push manifest lists
run: |
# Only create manifest on main branch
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
# Get list of all Dockerfile.* files to determine image names
for dockerfile in Dockerfile.*; do
image_name="${dockerfile//Dockerfile./}"
echo "Creating manifest for ${image_name}..."
# Remove any existing manifest to ensure we create a fresh one
docker manifest rm gitea.jde.nz/public/${image_name}:latest 2>/dev/null || true
# Create the manifest list using the architecture-specific images
# Note: publish.sh uses uname -m which gives x86_64 and aarch64
docker manifest create gitea.jde.nz/public/${image_name}:latest \
--amend gitea.jde.nz/public/${image_name}:latest-x86_64 \
--amend gitea.jde.nz/public/${image_name}:latest-aarch64
# Annotate the manifests with the correct architecture
docker manifest annotate gitea.jde.nz/public/${image_name}:latest \
gitea.jde.nz/public/${image_name}:latest-x86_64 --arch amd64
docker manifest annotate gitea.jde.nz/public/${image_name}:latest \
gitea.jde.nz/public/${image_name}:latest-aarch64 --arch arm64
# Push the manifest list
docker manifest push gitea.jde.nz/public/${image_name}:latest
echo "Manifest list for ${image_name} created and pushed successfully"
done
echo "All manifest lists created and pushed successfully"
fi