Files
daily-blackout-check/.gitea/workflows/build-runner-image.yml
Meghdad 3b661be40e
Some checks failed
Build runner image / build (push) Failing after 24s
Test blackout notifier / test (push) Failing after 0s
Fix duplicate Docker socket mount
2026-07-17 21:08:58 +03:30

72 lines
2.2 KiB
YAML

name: Build runner image
on:
push:
branches:
- main
paths:
- runner-image/**
- .gitea/workflows/build-runner-image.yml
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
image: node:20-bookworm
steps:
- name: Check out repository
uses: https://gitea.com/actions/checkout@v4
- name: Install Docker client
run: |
set -eu
for attempt in 1 2 3; do
if apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
--no-install-recommends docker.io; then
break
fi
if [ "$attempt" -eq 3 ]; then
echo "Unable to install the Docker client after 3 attempts"
exit 1
fi
sleep "$((attempt * 5))"
done
rm -rf /var/lib/apt/lists/*
docker version --format 'Docker client {{.Client.Version}}, server {{.Server.Version}}'
- name: Build, verify, and publish image
env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
set -eu
registry="mahgit.ir"
image="$registry/meghdadfadaee/daily-blackout-check-runner"
revision="$(git rev-parse --short=12 HEAD)"
candidate="$image:$revision"
cleanup() {
docker logout "$registry" >/dev/null 2>&1 || true
}
trap cleanup EXIT
printf '%s' "$REGISTRY_TOKEN" | docker login "$registry" \
--username "$REGISTRY_USERNAME" \
--password-stdin
docker build \
--pull \
--label "org.opencontainers.image.revision=$revision" \
--label "org.opencontainers.image.source=https://mahgit.ir/MeghdadFadaee/daily-blackout-check" \
--tag "$candidate" \
runner-image
docker run --rm "$candidate" python -c "import dotenv, jdatetime, requests"
docker run --rm "$candidate" pytest --version
docker run --rm "$candidate" ruff --version
docker push "$candidate"
docker tag "$candidate" "$image:latest"
docker push "$image:latest"