Alpine 3.21 is GA #412
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: build | |
on: | |
push: | |
paths: | |
- .github/workflows/build.yml | |
- Dockerfile.debian | |
- Dockerfile.redhat | |
pull_request: | |
paths: | |
- .github/workflows/build.yml | |
- Dockerfile.debian | |
- Dockerfile.redhat | |
schedule: | |
- cron: "42 10 * * 1" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
name: ${{ matrix.image }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image: debian:11-slim | |
dockerfile: Dockerfile.debian | |
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 | |
- image: debian:12-slim | |
dockerfile: Dockerfile.debian | |
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: debian:sid-slim | |
dockerfile: Dockerfile.debian | |
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: ubuntu:18.04 | |
dockerfile: Dockerfile.debian | |
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: ubuntu:20.04 | |
dockerfile: Dockerfile.debian | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: ubuntu:22.04 | |
dockerfile: Dockerfile.debian | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: ubuntu:24.04 | |
dockerfile: Dockerfile.debian | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: fedora:39 | |
dockerfile: Dockerfile.redhat | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: fedora:40 | |
dockerfile: Dockerfile.redhat | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: almalinux:8 | |
dockerfile: Dockerfile.redhat | |
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: almalinux:9 | |
dockerfile: Dockerfile.redhat | |
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: rockylinux:8 | |
dockerfile: Dockerfile.redhat | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: rockylinux:9 | |
dockerfile: Dockerfile.redhat | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: alpine:3.17 | |
dockerfile: Dockerfile.alpine | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: alpine:3.18 | |
dockerfile: Dockerfile.alpine | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: alpine:3.19 | |
dockerfile: Dockerfile.alpine | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: alpine:3.20 | |
dockerfile: Dockerfile.alpine | |
platforms: linux/amd64,linux/arm64/v8 | |
- image: alpine:3.21 | |
dockerfile: Dockerfile.alpine | |
platforms: linux/amd64,linux/arm64/v8 | |
env: | |
BASE_IMAGE: ${{ matrix.image }} | |
DOCKER_DEPLOY_IMAGES: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up env vars | |
run: | | |
set -vx | |
IMG_TMP="${BASE_IMAGE/:/-}" | |
echo "IMG=${IMG_TMP/-slim}" >>$GITHUB_ENV | |
echo "REPO=docker-systemd" >>$GITHUB_ENV | |
# See: https://github.com/actions/runner-images/issues/9425 | |
- name: Patch crun | |
shell: bash | |
run: | | |
curl -Lo ./crun https://github.com/containers/crun/releases/download/1.14.3/crun-1.14.3-linux-amd64 | |
sudo install crun /usr/bin/crun | |
- name: Install qemu-user-static | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
- name: Build images | |
run: | | |
podman manifest create ${{ env.REPO }}:${{ env.IMG }} | |
for arch in $(echo ${{ matrix.platforms }} | sed 's/,/ /g'); do | |
msg="Build $arch:" | |
line="${msg//?/=}" | |
printf "\n${line}\n${msg}\n${line}\n" | |
podman buildx build --tag ${{ env.REPO }}:${{ env.IMG }}-${arch//\//-} \ | |
--platform $arch \ | |
--manifest ${{ env.REPO }}:${{ env.IMG }} \ | |
-f ${{ matrix.dockerfile }} \ | |
--build-arg base_image=${{ matrix.image }} | |
done | |
podman images | |
- name: Push images to local registry | |
run: | | |
podman manifest push --tls-verify=0 \ | |
--all ${{ env.REPO }}:${{ env.IMG }} \ | |
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} | |
- name: Systemd check | |
if: (!contains(matrix.dockerfile, 'alpine')) | |
run: | | |
podman run --tls-verify=0 --name sys-test --rm -d \ | |
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} | |
# debian 9 takes time to boot | |
if [[ "$BASE_IMAGE" == "debian:9-slim" ]]; then | |
sleep 100 | |
else | |
sleep 2 | |
fi | |
podman exec -it sys-test systemd-analyze | |
- name: OpenRC check | |
if: (contains(matrix.dockerfile, 'alpine')) | |
run: | | |
podman run --tls-verify=0 --name init-test --rm -d \ | |
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} | |
podman exec -it init-test rc-status | |
- name: Check GitHub settings | |
if: > | |
(github.event_name == 'push' || github.event_name == 'schedule') && | |
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && | |
github.repository == 'fauust/docker-systemd' | |
run: | | |
missing=() | |
[[ -n "${{ secrets.DOCKER_USER }}" ]] || missing+=(DOCKER_USER) | |
[[ -n "${{ secrets.DOCKER_TOKEN }}" ]] || missing+=(DOCKER_TOKEN) | |
for i in "${missing[@]}"; do | |
echo "Missing github secret: $i" | |
done | |
(( ${#missing[@]} == 0 )) || exit 1 | |
echo "DOCKER_DEPLOY_IMAGES=true" >> $GITHUB_ENV | |
- name: Login to ghcr.io | |
if: ${{ env.DOCKER_DEPLOY_IMAGES == 'true' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push images to ghcr.io | |
if: ${{ env.DOCKER_DEPLOY_IMAGES == 'true' }} | |
run: | | |
msg="Push docker image to ghcr.io (${{ env.IMG }})" | |
line="${msg//?/=}" | |
printf "\n${line}\n${msg}\n${line}\n" | |
skopeo copy --all --src-tls-verify=0 \ | |
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} \ | |
docker://ghcr.io/${{ secrets.DOCKER_USER }}/${{ env.REPO }}:${{ env.IMG }} | |
- name: Login to docker.io | |
if: ${{ env.DOCKER_DEPLOY_IMAGES == 'true' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Push images to docker.io | |
if: ${{ env.DOCKER_DEPLOY_IMAGES == 'true' }} | |
run: | | |
msg="Push docker image to docker.io (${{ env.IMG }})" | |
line="${msg//?/=}" | |
printf "\n${line}\n${msg}\n${line}\n" | |
skopeo copy --all --src-tls-verify=0 \ | |
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} \ | |
docker://docker.io/${{ secrets.DOCKER_USER }}/${{ env.REPO }}:${{ env.IMG }} | |
- name: Update docker.io description | |
if: ${{ env.DOCKER_DEPLOY_IMAGES == 'true' }} | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
repository: ${{ secrets.DOCKER_USER }}/${{ env.REPO }} | |
readme-filepath: README.md |