# A Project Reclaimer master server on its own, in Docker: no game servers
# and no game files. Guide: https://projectreclaimer.dev/masters
#
# Put this file in a folder of its own, next to an empty data/ folder, then:
#
#   docker compose up -d
#   docker compose logs -f
#
# Update to the newest release: docker compose pull && docker compose up -d

name: reclaimer-master

services:
  master:
    # The dedicated server image, which includes the master. Set IMAGE in
    # .env to stay on one version.
    image: ${IMAGE:-ghcr.io/projectreclaimer/project-reclaimer-dedicated:latest}
    restart: unless-stopped
    command: ["project-reclaimer", "discovery-master", "--bind", "0.0.0.0:49175"]
    # The master stops cleanly on Ctrl+C (SIGINT).
    stop_signal: SIGINT
    stop_grace_period: 10s
    environment:
      # The masters it learned (peers.json) are kept in ./data/discovery.
      # Z: is the container's / as the program, running under Wine, sees it.
      RECLAIMER_DISCOVERY_DIR: 'Z:\server\discovery'
    volumes:
      - ./data:/server
    ports:
      - "49175:49175/tcp"
    # The image's health check watches dedicated servers, which this
    # container doesn't run.
    healthcheck:
      disable: true
    security_opt:
      - no-new-privileges:true
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: "3"
