Trigger alpine builds #260
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.alpine | |
- Dockerfile.debian | |
- Dockerfile.redhat | |
pull_request: | |
paths: | |
- .github/workflows/build.yml | |
- Dockerfile.alpine | |
- Dockerfile.debian | |
- Dockerfile.redhat | |
schedule: | |
- cron: "42 13 * * 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 | |
dockerfile: Dockerfile.debian | |
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 | |
- image: debian-12 | |
dockerfile: Dockerfile.debian | |
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
- image: debian-sid | |
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: fedora-41 | |
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 | |
echo "IMG=${BASE_IMAGE}">>$GITHUB_ENV | |
echo "REPO=docker-ansible">>$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: Python3 check | |
run: | | |
podman run --tls-verify=0 --name python-test --rm -d \ | |
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} | |
podman exec -it python-test python3 -V | |
- 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-ansible' | |
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 |