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

services:
  dockge:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-}louislam/dockge:${DOCKGE_VERSION:-1}
    ports:
      - '${PORT_OVERRIDE:-5001}:5001'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - dockge_data:/app/data
      - ${STACKS_DIR:-./stacks}:/opt/stacks
    environment:
      - TZ=${TZ:-UTC}
      - DOCKGE_STACKS_DIR=${DOCKGE_STACKS_DIR:-/opt/stacks}
      - PUID=${PUID:-1000}
      - PGID=${PGID:-1000}
    deploy:
      resources:
        limits:
          cpus: ${DOCKGE_CPU_LIMIT:-1.0}
          memory: ${DOCKGE_MEMORY_LIMIT:-512M}
        reservations:
          cpus: ${DOCKGE_CPU_RESERVATION:-0.1}
          memory: ${DOCKGE_MEMORY_RESERVATION:-256M}
    healthcheck:
      test: [CMD, wget, --no-verbose, --tries=1, --spider, 'http://localhost:5001/']
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

volumes:
  dockge_data:
