Some checks failed
CI/CD Pipeline / Code Quality (push) Failing after 15s
CI/CD Pipeline / Unit Tests (push) Has been skipped
CI/CD Pipeline / Build Test Image (push) Has been skipped
CI/CD Pipeline / Build Production Image (push) Has been skipped
CI/CD Pipeline / Deploy to Test (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
将所有 docker-compose(V1)替换为 docker compose(V2): - CI/CD 流水线、部署脚本、文档中的命令调用 - 安装包名 docker-compose → docker-compose-plugin
69 lines
1.5 KiB
YAML
69 lines
1.5 KiB
YAML
# ========================================
|
||
# 服务器部署配置(单服务器 Phase 1)
|
||
# 包含生产环境和测试环境(按需启停)
|
||
#
|
||
# 用法:
|
||
# 生产环境:docker compose up -d
|
||
# 含测试: docker compose --profile test up -d
|
||
# 停止测试:docker compose --profile test stop api-test
|
||
# ========================================
|
||
|
||
version: '3.8'
|
||
|
||
services:
|
||
# ===== 生产环境 =====
|
||
api-prod:
|
||
build:
|
||
context: .
|
||
dockerfile: Dockerfile
|
||
image: duoqi-api:prod
|
||
container_name: duoqi-api-prod
|
||
restart: unless-stopped
|
||
env_file: .env.prod
|
||
ports:
|
||
- "3000:3000"
|
||
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"
|
||
env_file: .env.test
|
||
ports:
|
||
- "3001:3001"
|
||
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
|