version: "3.8"
services:
  falah-mobile:
    build: .
    image: falah-mobile:latest
    ports:
      - "4013:3000"
    environment:
      - NODE_ENV=production
      - HOSTNAME=0.0.0.0
      - NEXT_PUBLIC_APP_URL=https://falahos.my/mobile
      - JWT_SECRET=${JWT_SECRET}
      - DATABASE_URL=file:/app/data/dev.db
      - UMMAHID_URL=https://ummahid.falahos.my
      - LLM_API_KEY=${LLM_API_KEY:-}
      - LLM_BASE_URL=${LLM_BASE_URL:-}
      - LLM_MODEL=${LLM_MODEL:-qwen3.6-plus}
      # Polar.sh payments (optional — mock mode used when unset)
      - POLAR_ACCESS_TOKEN=${POLAR_ACCESS_TOKEN:-}
      - POLAR_FLH_500=${POLAR_FLH_500:-}
      - POLAR_FLH_1000=${POLAR_FLH_1000:-}
      - POLAR_FLH_5000=${POLAR_FLH_5000:-}
      - POLAR_FLH_10000=${POLAR_FLH_10000:-}
      - POLAR_FLH_50000=${POLAR_FLH_50000:-}
      - POLAR_WEBHOOK_SECRET=${POLAR_WEBHOOK_SECRET:-}
    volumes:
      - falah-mobile-data:/app/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/mobile/api/health"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  falah-mobile-data:
