duoqi-api/docker-compose.prod.yml
Wang Zhuoxuan 9d1f52d95b
All checks were successful
CI/CD Pipeline / Code Quality (push) Successful in 15s
CI/CD Pipeline / Unit Tests (push) Successful in 8s
CI/CD Pipeline / Build & Deploy Test (push) Has been skipped
CI/CD Pipeline / Build & Deploy Production (push) Successful in 1m15s
fix: health 路由路径修正为 /health
healthRoutes 注册时无 /v1 前缀,实际路径是 /health 而非 /v1/health。
将 auth 中间件白名单从 /v1/health 改为 /health,并同步修正所有
HEALTHCHECK 和 CI health check 路径。
2026-04-18 04:13:59 +08:00

67 lines
1.6 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ========================================
# 服务器部署配置(单服务器 Phase 1
# 包含生产环境和测试环境(按需启停)
#
# 使用 host 网络模式,避免 Docker bridge 子网与 VPC 内网冲突
#
# 用法:
# 生产环境docker compose up -d
# 含测试: docker compose --profile test up -d
# 停止测试docker compose --profile test stop api-test
# ========================================
services:
# ===== 生产环境 =====
api-prod:
build:
context: .
dockerfile: Dockerfile
image: duoqi-api:prod
container_name: duoqi-api-prod
restart: unless-stopped
network_mode: host
env_file: .env.prod
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 400M
# ===== 测试环境Docker profiles 按需启停) =====
api-test:
build:
context: .
dockerfile: Dockerfile
image: duoqi-api:test
container_name: duoqi-api-test
restart: "no"
network_mode: host
env_file: .env.test
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
deploy:
resources:
limits:
memory: 300M
profiles:
- test