# ================================================================ # VetCopilot 生产环境部署配置 # # 适用平台:阿里云 ECS / 腾讯云 CVM(教育优惠 ~100元/年) # 域名获取:阿里云万网 / 腾讯云 DNSPod(教育优惠 ~1元/年) # # 使用方法: # 1. 复制 .env.production.example 为 .env.production 并填写配置 # 2. docker compose --env-file .env.production up -d # 3. 配置 Nginx 反向代理和 HTTPS(使用 acme.sh + Let's Encrypt) # # 最低配置: 2C4G(推荐 4C8G,如需本地 ASR 模型建议 8G+ 内存) # ================================================================ version: "3.8" services: # ---- 后端 API 服务 ---- backend: build: context: ../vetcopilot-backend dockerfile: ../deploy/Dockerfile.backend container_name: vetcopilot-backend restart: unless-stopped ports: - "127.0.0.1:8080:8080" volumes: - backend_data:/app/data - backend_uploads:/app/uploads - backend_logs:/app/logs - backend_backups:/app/backups # 如需持久化 ASR 模型缓存: - asr_models:/root/.cache/modelscope - whisper_models:/root/.cache/whisper env_file: - .env.production environment: - HOST=0.0.0.0 - PORT=8080 - DATABASE_URL=sqlite:///./data/vetcopilot.db - UPLOAD_DIR=./uploads - LOG_DIR=./logs - BACKUP_DIR=./backups healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/api/system/health"] interval: 30s timeout: 10s retries: 3 start_period: 60s networks: - vetcopilot_net # ---- 前端静态服务 ---- frontend: build: context: ../vetcopilot-app dockerfile: ../deploy/Dockerfile.frontend container_name: vetcopilot-frontend restart: unless-stopped depends_on: backend: condition: service_healthy ports: - "127.0.0.1:5173:80" networks: - vetcopilot_net # ---- Nginx 反向代理 ---- nginx: image: nginx:alpine container_name: vetcopilot-nginx restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx-site.conf:/etc/nginx/conf.d/default.conf:ro - certbot_data:/etc/letsencrypt - certbot_www:/var/www/certbot depends_on: - backend - frontend networks: - vetcopilot_net volumes: backend_data: backend_uploads: backend_logs: backend_backups: asr_models: whisper_models: certbot_data: certbot_www: networks: vetcopilot_net: driver: bridge