version: "3.8"

services:
  mana-llm:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: mana-llm
    ports:
      - "3025:3025"
    environment:
      - PORT=3025
      - LOG_LEVEL=info
      - OLLAMA_URL=http://host.docker.internal:11434
      - OLLAMA_DEFAULT_MODEL=gemma3:4b
      - OLLAMA_TIMEOUT=120
      - REDIS_URL=redis://redis:6379
      # Add API keys via .env file
      - OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
      - GROQ_API_KEY=${GROQ_API_KEY:-}
      - TOGETHER_API_KEY=${TOGETHER_API_KEY:-}
      - CORS_ORIGINS=http://localhost:5173,http://localhost:3000,https://mana.how
    depends_on:
      - redis
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:3025/health').raise_for_status()"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    extra_hosts:
      - "host.docker.internal:host-gateway"

  redis:
    image: redis:7-alpine
    container_name: mana-llm-redis
    ports:
      - "6380:6379"
    volumes:
      - redis-data:/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  redis-data:
