with service ?
Some checks failed
Build and Push Ansible Container / build-and-push (arm64) (push) Failing after 30s
Build and Push Ansible Container / build-and-push (amd64) (push) Failing after 31s
Build and Push Ansible Container / manifest (push) Has been skipped
Build and Push Docker-in-Docker Container / build-and-push (amd64) (push) Failing after 45s
Build and Push Docker-in-Docker Container / build-and-push (arm64) (push) Failing after 47s
Build and Push Docker-in-Docker Container / create-manifest (push) Has been skipped

This commit is contained in:
Xaver Russ 2025-07-14 01:06:06 +02:00
parent 28e2f61a42
commit e8920989dd
2 changed files with 104 additions and 34 deletions

View file

@ -28,16 +28,40 @@ jobs:
# Use a runner that matches the architecture.
# This assumes you have runners tagged with 'amd64' and 'arm64'.
runs-on: ${{ matrix.arch }}
# Add a Docker-in-Docker service to the job.
# This is necessary to build Docker images.
# The 'privileged' flag is required for the Docker daemon to run.
services:
dind:
image: docker:dind
privileged: true
# Set the DOCKER_HOST environment variable to connect to the dind service.
env:
DOCKER_HOST: tcp://dind:2375
steps:
# 1. Check out the repository code
- name: Checkout repository
uses: actions/checkout@v4
# 2. Set up Docker Buildx for multi-platform builds
# 2. Wait for the Docker daemon to be ready
- name: Wait for Docker to start
run: |
i=0
while ! docker info >/dev/null 2>&1; do
i=$((i+1))
if [ $i -ge 15 ]; then
echo "Docker did not start within 15 seconds"
exit 1
fi
echo "Waiting for Docker to start..."
sleep 1
done
# 3. Set up Docker Buildx for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 3. Login to the Forgejo container registry
# 4. Login to the Forgejo container registry
# Requires CI_REGISTRY, CI_REGISTRY_USER, and CI_TOKEN secrets to be set in Forgejo.
- name: Login to Forgejo Registry
uses: docker/login-action@v3
@ -46,7 +70,7 @@ jobs:
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_TOKEN }}
# 4. Build and push the Docker image for the specific architecture
# 5. Build and push the Docker image for the specific architecture
- name: Build and push (${{ matrix.arch }})
uses: docker/build-push-action@v5
with:
@ -65,8 +89,32 @@ jobs:
needs: build-and-push
# A standard runner is sufficient for creating a manifest
runs-on: amd64
# Add a Docker-in-Docker service to the job.
# This is necessary to create the manifest.
# The 'privileged' flag is required for the Docker daemon to run.
services:
dind:
image: docker:dind
privileged: true
# Set the DOCKER_HOST environment variable to connect to the dind service.
env:
DOCKER_HOST: tcp://dind:2375
steps:
# 1. Login to the Forgejo container registry again
# 1. Wait for the Docker daemon to be ready
- name: Wait for Docker to start
run: |
i=0
while ! docker info >/dev/null 2>&1; do
i=$((i+1))
if [ $i -ge 15 ]; then
echo "Docker did not start within 15 seconds"
exit 1
fi
echo "Waiting for Docker to start..."
sleep 1
done
# 2. Login to the Forgejo container registry again
- name: Login to Forgejo Registry
uses: docker/login-action@v3
with:
@ -74,7 +122,7 @@ jobs:
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_TOKEN }}
# 2. Create and push the multi-arch manifest
# 3. Create and push the multi-arch manifest
# This combines the amd64 and arm64 images under a single 'latest' tag.
- name: Create and push multi-arch manifest
run: |