version: '3.8' services: multi-agent-system: build: context: . dockerfile: Dockerfile container_name: multi-agent-delivery-system restart: unless-stopped ports: - "8000:8000" environment: # DashScope API Key(必需) - DASHSCOPE_API_KEY=${DASHSCOPE_API_KEY:-your_api_key_here} # 可选配置 - HOST=0.0.0.0 - PORT=8000 # 日志级别 - LOG_LEVEL=info volumes: # 挂载日志目录 - ./logs:/app/logs # 如果需要持久化 .env 文件 - ./.env:/app/.env:ro networks: - agent-network # 资源限制 deploy: resources: limits: cpus: '2.0' memory: 4G reservations: cpus: '0.5' memory: 1G # 健康检查 healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s retries: 3 start_period: 10s # Nginx 反向代理(可选,用于生产环境) nginx: image: nginx:alpine container_name: multi-agent-nginx restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./ssl:/etc/nginx/ssl:ro # SSL 证书目录(如果需要 HTTPS) depends_on: - multi-agent-system networks: - agent-network profiles: - production # 仅在生产环境启动 networks: agent-network: driver: bridge # 使用示例: # 开发环境:docker-compose up -d # 生产环境:docker-compose --profile production up -d