services:
  app:
    build: .
    container_name: insta-recipe
    network_mode: host
    ports:
      - "3000:3000"
    environment:
      # LLM Configuration (Required)
      - OPENAI_BASE_URL=${OPENAI_BASE_URL}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - LLM_MODEL=${LLM_MODEL:-google/gemma-3-4b}
      
      # Queue Configuration (Optional)
      - QUEUE_CONCURRENCY=${QUEUE_CONCURRENCY:-2}
      - QUEUE_MAX_RETRIES=${QUEUE_MAX_RETRIES:-3}
      
      # Tandoor Integration (Optional)
      - TANDOOR_ENABLED=${TANDOOR_ENABLED:-false}
      - TANDOOR_SERVER_URL=${TANDOOR_SERVER_URL}
      - TANDOOR_SPACE=${TANDOOR_SPACE:-1}
      - TANDOOR_TOKEN=${TANDOOR_TOKEN}
      
      # Push Notifications (Optional)
      - VAPID_PUBLIC_KEY=${VAPID_PUBLIC_KEY}
      - VAPID_PRIVATE_KEY=${VAPID_PRIVATE_KEY}
      
      # Authentication Scheduler (Optional)
      - AUTH_SCHEDULER_ENABLED=${AUTH_SCHEDULER_ENABLED:-false}
      - AUTH_SCHEDULER_INTERVAL_MINUTES=${AUTH_SCHEDULER_INTERVAL_MINUTES:-720}
      
      # Playwright Configuration
      - DISPLAY=:99
      
      # Node.js Environment
      - NODE_ENV=production
    security_opt:
      - seccomp=unconfined
    volumes:
      - ./secrets:/app/secrets
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "node", "-e", "fetch('http://localhost:3000/api/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s