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

services:
  gitlab-runner:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-}gitlab/gitlab-runner:${GITLAB_RUNNER_VERSION:-alpine3.21-v18.4.0}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config:/etc/gitlab-runner
    environment:
      - TZ=${TZ:-UTC}
    deploy:
      resources:
        limits:
          cpus: ${GITLAB_RUNNER_CPU_LIMIT:-1.0}
          memory: ${GITLAB_RUNNER_MEMORY_LIMIT:-2G}
        reservations:
          cpus: ${GITLAB_RUNNER_CPU_RESERVATION:-0.1}
          memory: ${GITLAB_RUNNER_MEMORY_RESERVATION:-1G}
