x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: 100m
      max-file: '3'

services:
  gitea_runner:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-}gitea/act_runner:${GITEA_RUNNER_VERSION:-0.2.13}
    environment:
      TZ: ${TZ:-UTC}
      CONFIG_FILE: /config.yaml
      GITEA_INSTANCE_URL: ${INSTANCE_URL:-http://localhost:3000}
      GITEA_RUNNER_REGISTRATION_TOKEN: ${REGISTRATION_TOKEN}
      GITEA_RUNNER_NAME: ${RUNNER_NAME:-Gitea-Runner}
      GITEA_RUNNER_LABELS: ${RUNNER_LABELS:-DockerRunner}
    volumes:
      - ./config.yaml:/config.yaml:ro
      - gitea_runner_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      resources:
        limits:
          cpus: ${GITEA_RUNNER_CPU_LIMIT:-1.0}
          memory: ${GITEA_RUNNER_MEMORY_LIMIT:-2G}
        reservations:
          cpus: ${GITEA_RUNNER_CPU_RESERVATION:-0.1}
          memory: ${GITEA_RUNNER_MEMORY_RESERVATION:-1G}

volumes:
  gitea_runner_data:
