services:
  gantt-board:
    image: gantt-board:latest
    pull_policy: build
    build:
      context: .
      dockerfile: Dockerfile
      args:
        NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL:-https://example.supabase.co}
        NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY:-public-anon-placeholder}
        NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:8300}
        SUPABASE_SERVICE_ROLE_KEY: ${SUPABASE_SERVICE_ROLE_KEY:-service-role-placeholder}
    restart: unless-stopped
    ports:
      - "${APP_PORT:-8300}:8300"
    environment:
      NODE_ENV: production
      NEXT_TELEMETRY_DISABLED: "1"
      NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL:-}
      NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY:-}
      SUPABASE_SERVICE_ROLE_KEY: ${SUPABASE_SERVICE_ROLE_KEY:-}
      SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL:-}
      SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY:-}
      NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-}
      GANTT_MACHINE_TOKEN: ${GANTT_MACHINE_TOKEN:-}
      GANTT_MACHINE_USER_ID: ${GANTT_MACHINE_USER_ID:-}
      GANTT_MACHINE_USER_NAME: ${GANTT_MACHINE_USER_NAME:-}
      GANTT_MACHINE_USER_EMAIL: ${GANTT_MACHINE_USER_EMAIL:-}
      RESEND_API_KEY: ${RESEND_API_KEY:-}
      RESEND_FROM_EMAIL: ${RESEND_FROM_EMAIL:-}
      EMAIL_FROM: ${EMAIL_FROM:-}
      VERCEL_URL: ${VERCEL_URL:-}
    volumes:
      - gantt_board_data:/app/data
    healthcheck:
      test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:8300/login').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 45s

volumes:
  gantt_board_data:
