version: '3.8'

services:
  ai-service:
    build:
      context: .
      dockerfile: docker/Dockerfile
    image: erp-ai-service:latest
    container_name: erp-ai-service
    ports:
      - "8087:8087"
    environment:
      - SPRING_PROFILES_ACTIVE=docker
      - DB_HOST=111.229.80.149
      - DB_PORT=3306
      - DB_NAME=erp_db
      - DB_USER=root
      - DB_PASSWORD=nihao588+
      - REDIS_HOST=111.229.80.149
      - REDIS_PORT=6379
      - REDIS_PASSWORD=Y(@r5tGk9\$Lp2
      - NACOS_HOST=111.229.80.149
      - NACOS_NAMESPACE=public
      - AI_DEFAULT_SERVICE=openai
      - OPENAI_API_KEY=${OPENAI_API_KEY:-}
      - ALIYUN_QWEN_API_KEY=${ALIYUN_QWEN_API_KEY:-}
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
    networks:
      - erp-network
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8087/api/ai/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 1G
        reservations:
          cpus: '0.5'
          memory: 512M

networks:
  erp-network:
    external: true
