version: '3.8'

services:
  rmaps:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: rmaps-online
    restart: unless-stopped
    environment:
      - NODE_ENV=production
      - PORT=3000
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.rmaps.rule=Host(`rmaps.online`) || Host(`www.rmaps.online`)"
      - "traefik.http.routers.rmaps.entrypoints=web"
      - "traefik.http.services.rmaps.loadbalancer.server.port=3000"
    networks:
      - traefik-public
    healthcheck:
      test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

networks:
  traefik-public:
    external: true
