# Gitea Actions Runner for Calypso
# This runner enables CI/CD workflows for git.vish.gg
#
# IMPORTANT: The GITEA_RUNNER_TOKEN env var must be set in the Portainer stack env
# (or as a Docker secret) before deploying. Get a token from:
#   https://git.vish.gg/-/admin/runners  (site-level, admin only)
#   or per-repo: https://git.vish.gg/Vish/homelab/settings/actions/runners
#
# If the runner gets stuck in a registration loop ("runner registration token not found"),
# the token has expired or the Gitea instance was updated. Get a new token and recreate:
#   docker stop gitea-runner && docker rm gitea-runner
#   docker run -d --name gitea-runner ... -e GITEA_RUNNER_REGISTRATION_TOKEN=<new-token> ...
# Or redeploy this stack with the updated GITEA_RUNNER_TOKEN env var in Portainer.

version: "3"
services:
  gitea-runner:
    image: gitea/act_runner:latest
    container_name: gitea-runner
    restart: unless-stopped
    env_file:
      - /volume1/docker/gitea-runner/stack.env   # contains GITEA_RUNNER_TOKEN=<token>
    environment:
      - GITEA_INSTANCE_URL=https://git.vish.gg
      - GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN:-CHANGE_ME}
      - GITEA_RUNNER_NAME=calypso-runner
      - GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:20-bookworm,ubuntu-22.04:docker://ubuntu:22.04,python:docker://python:3.11
    volumes:
      - gitea-runner-data:/data
      - /var/run/docker.sock:/var/run/docker.sock

volumes:
  gitea-runner-data:
