File size: 2,624 Bytes
793e953
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ================================================================
# 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