services:
  jailgames:
    container_name: jailgames
    hostname: jailgames
    image: nginx:alpine

    volumes:
      # Contenido del sitio: copiar aquí el resultado de "npm run build" (_site/)
      - /var/volumes/web_jailgames:/usr/share/nginx/html:ro
      # Configuración Nginx: copiar nginx.conf del repo aquí con nombre jailgames.conf
      # No se llama default.conf para evitar que el entrypoint de nginx lo modifique
      - /var/volumes/web_jailgames-nginx/jailgames.conf:/etc/nginx/conf.d/jailgames.conf:ro
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

    networks:
      - web

    labels:
      - traefik.enable=true
      - traefik.docker.network=web
      - traefik.http.routers.jailgames.rule=Host(`jailgames.sustancia.synology.me`)
      - traefik.http.routers.jailgames.tls=true
      - traefik.http.routers.jailgames.tls.certresolver=letsencrypt
      - traefik.http.services.jailgames.loadbalancer.server.scheme=http
      - traefik.http.services.jailgames.loadbalancer.server.port=80

    healthcheck:
      test: ["CMD", "pgrep", "nginx"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

    restart: unless-stopped

networks:
  web:
    external: true
