services:
  app:
    build:
      context: .
      args:
        NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
        NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: ${NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY}
    container_name: ${PROJECT_NAME}-app
    restart: unless-stopped
    network_mode: bridge

    # DO NOT CHANGE - port is managed by gateway
    ports:
      - "172.17.0.1:${PORT}:3000"

    # Pass only Supabase secrets at runtime — never the gateway's PROJECT_NAME/PORT,
    # which would clobber Next.js's own PORT (it listens on 3000 inside the container).
    environment:
      NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
      NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: ${NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY}
      SUPABASE_SECRET_KEY: ${SUPABASE_SECRET_KEY}

    mem_limit: 1g
    cpus: 1.0
