version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "4321:4321"
    environment:
      - NODE_ENV=production
      - SUPABASE_URL=${SUPABASE_URL}
      - SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY}
      - SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}
      - PAYSOLO_MERCHANT_ID=${PAYSOLO_MERCHANT_ID}
      - PAYSOLO_API_KEY=${PAYSOLO_API_KEY}
      - PAYSOLO_SECRET_KEY=${PAYSOLO_SECRET_KEY}
      - JWT_SECRET=${JWT_SECRET}
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4321/"]
      interval: 30s
      timeout: 3s
      retries: 3

  # Optional: Local Supabase (for development)
  # supabase:
  #   image: supabase/postgres:15.1.0.117
  #   ports:
  #     - "5432:5432"
  #   environment:
  #     POSTGRES_PASSWORD: postgres
  #     POSTGRES_DB: postgres
  #   volumes:
  #     - supabase-data:/var/lib/postgresql/data
  #     - ./supabase/migrations:/docker-entrypoint-initdb.d

volumes:
  supabase-data:
