name: Build and Push LOGAR Runner on: workflow_dispatch: release: types: [published] jobs: build-and-push: name: Build & Push Runner Image runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Ensure Docker CLI is available run: | if ! command -v docker >/dev/null 2>&1; then echo "Docker CLI not found. Downloading static Docker CLI binary..." curl -fSL --connect-timeout 15 --max-time 120 --retry 3 https://download.docker.com/linux/static/stable/x86_64/docker-27.3.1.tgz -o /tmp/docker.tgz tar -xzf /tmp/docker.tgz -C /usr/local/bin --strip-components=1 docker/docker chmod +x /usr/local/bin/docker rm -f /tmp/docker.tgz fi docker version - name: Log in to Gitea Container Registry run: | REGISTRY="gitea.eibl.tech" USER="${{ secrets.GITEAUSER || secrets.PACKAGESUSER || github.actor }}" PASS="${{ secrets.GITEATOKEN || secrets.PACKAGESTOKEN || secrets.TAG_TOKEN || github.token }}" echo "Logging in to ${REGISTRY} as ${USER}..." echo "${PASS}" | docker login "${REGISTRY}" -u "${USER}" --password-stdin - name: Build Docker Image env: DOCKER_BUILDKIT: "0" run: | IMAGE_TAG="gitea.eibl.tech/me0nline/logar-runner:latest" echo "Building ${IMAGE_TAG}..." docker build \ -t "${IMAGE_TAG}" \ -f runner/Dockerfile \ runner/ - name: Push to Gitea Container Registry run: | IMAGE_TAG="gitea.eibl.tech/me0nline/logar-runner:latest" echo "Pushing ${IMAGE_TAG} to Gitea Container Registry..." docker push "${IMAGE_TAG}" echo "Successfully pushed ${IMAGE_TAG} to Gitea Container Registry!" - name: Trigger Portainer redeploy via webhook run: | echo "Notifying Portainer to redeploy the runner stack..." curl -s -X POST \ "https://portainer.eibl.tech/api/stacks/webhooks/6e67c0b7-1c5d-4bb2-b8b8-4a6ec66d3b87" echo "✓ Portainer webhook triggered" - name: Clean up temporary runner base images (node:16-bullseye) from Docker host if: always() run: | echo "[*] Cleaning up temporary base images from Docker host daemon..." # Remove node:16-bullseye images used by act_runner for ubuntu-latest docker images --filter "reference=*bullseye*" -q | xargs -r docker rmi -f 2>/dev/null || true docker rmi -f node:16-bullseye node:16-bullseye-slim 2>/dev/null || true # Prune dangling intermediate build cache layers docker image prune -f 2>/dev/null || true echo "[+] Cleaned up 16-bullseye and intermediate build images from host daemon."