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

services:
  openlist:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-}openlistteam/openlist:${OPENLIST_VERSION:-latest}
    ports:
      - '${OPENLIST_PORT_OVERRIDE:-5244}:5244'
    volumes:
      - openlist_data:/opt/openlist/data
    environment:
      - TZ=${TZ:-UTC}
      - PUID=${PUID:-0}
      - PGID=${PGID:-0}
      - UMASK=${UMASK:-022}
    deploy:
      resources:
        limits:
          cpus: ${OPENLIST_CPU_LIMIT:-1.0}
          memory: ${OPENLIST_MEMORY_LIMIT:-1G}
        reservations:
          cpus: ${OPENLIST_CPU_RESERVATION:-0.1}
          memory: ${OPENLIST_MEMORY_RESERVATION:-256M}
    healthcheck:
      test:
        - CMD
        - wget
        - --no-verbose
        - --tries=1
        - --spider
        - 'http://localhost:5244/'

      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s

volumes:
  openlist_data:
