duoqi-api/docker-compose.prod.yml
Wang Zhuoxuan e893755340 feat: 添加 CI/CD 部署方案(Gitea + Docker + 双分支工作流)
- Dockerfile: 多阶段构建,oven/bun 基础镜像,非 root 用户
- docker-compose.yml: 本地开发环境(API + MySQL + Drizzle Studio)
- docker-compose.prod.yml: 服务器部署(prod + test,Docker profiles)
- .gitea/workflows/deploy.yml: 双分支 CI/CD(develop→测试, main→生产)
- docs/ci-deployment-guide.md: 完整部署指南(Alibaba Cloud Linux 3)
- scripts/deploy.sh: 手动部署运维脚本
- .env.prod.example: 生产环境变量模板
- .dockerignore: 排除非构建文件
- .gitignore: 排除 .claude/ 目录
2026-04-16 12:44:14 +08:00

69 lines
1.5 KiB
YAML
Raw 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
# 包含生产环境和测试环境(按需启停)
#
# 用法:
# 生产环境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