version: '3.8'

services:
  quantumtaskai-website:
    build: .
    container_name: quantumtaskai-website
    restart: unless-stopped
    # ports:
      # - "80:80"  # Removed: Traefik handles routing
    environment:
      - NODE_ENV=production
    # networks:
      # - web  # Removed: using default network
    labels:
      # Dokploy labels for automatic configuration
      - "traefik.enable=true"
      - "traefik.http.routers.quantumtaskai-website.rule=Host(`quantumtaskai.com`) || Host(`www.quantumtaskai.com`)"
      - "traefik.http.routers.quantumtaskai-website.tls=true"
      - "traefik.http.routers.quantumtaskai-website.tls.certresolver=letsencrypt"
      - "traefik.http.services.quantumtaskai-website.loadbalancer.server.port=80"
      # Optional: redirect www to non-www
      - "traefik.http.middlewares.www-redirect.redirectregex.regex=^https://www\\.quantumtaskai\\.com/(.*)"
      - "traefik.http.middlewares.www-redirect.redirectregex.replacement=https://quantumtaskai.com/$${1}"
      - "traefik.http.routers.quantumtaskai-website.middlewares=www-redirect"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:80"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s

# networks:
  # web:
    # external: true
