Initial commit: 浼佷笟寰俊 AI 鏈哄櫒浜哄姪鐞?MVP
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
94
docker-compose.prod.yml
Normal file
94
docker-compose.prod.yml
Normal file
@@ -0,0 +1,94 @@
|
||||
# 生产环境 Docker Compose 配置
|
||||
# 用途:云端生产部署
|
||||
# 使用: docker-compose -f docker-compose.prod.yml --env-file .env.prod up -d
|
||||
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
backend:
|
||||
image: ghcr.io/${GITHUB_REPOSITORY_OWNER:-your-org}/wecom-ai-backend:${IMAGE_TAG:-latest}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: deploy/docker/backend.Dockerfile
|
||||
env_file:
|
||||
- .env.prod
|
||||
environment:
|
||||
# 数据库连接(如果启用 db 服务)
|
||||
# DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-wecom}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-wecom_ai}
|
||||
# DATABASE_URL_SYNC: postgresql://${POSTGRES_USER:-wecom}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-wecom_ai}
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
# Admin 服务(可选,最小回调壳可以先不启用)
|
||||
# admin:
|
||||
# image: ghcr.io/${GITHUB_REPOSITORY_OWNER:-your-org}/wecom-ai-admin:${IMAGE_TAG:-latest}
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: deploy/docker/admin.Dockerfile
|
||||
# env_file:
|
||||
# - .env.prod
|
||||
# restart: unless-stopped
|
||||
# healthcheck:
|
||||
# test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 3
|
||||
# start_period: 40s
|
||||
# networks:
|
||||
# - app-network
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./deploy/docker/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
# SSL 证书挂载(Let's Encrypt)
|
||||
- /etc/letsencrypt:/etc/letsencrypt:ro
|
||||
# Certbot 验证文件
|
||||
- /var/www/certbot:/var/www/certbot:ro
|
||||
# Nginx 日志
|
||||
- ./logs/nginx:/var/log/nginx
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
# admin:
|
||||
# condition: service_healthy
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
# 数据库服务(可选,最小回调壳可以先不启用)
|
||||
# db:
|
||||
# image: postgres:16-alpine
|
||||
# env_file:
|
||||
# - .env.prod
|
||||
# environment:
|
||||
# POSTGRES_USER: ${POSTGRES_USER:-wecom}
|
||||
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
# POSTGRES_DB: ${POSTGRES_DB:-wecom_ai}
|
||||
# volumes:
|
||||
# - pgdata:/var/lib/postgresql/data
|
||||
# restart: unless-stopped
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-wecom} -d ${POSTGRES_DB:-wecom_ai}"]
|
||||
# interval: 10s
|
||||
# timeout: 5s
|
||||
# retries: 5
|
||||
# networks:
|
||||
# - app-network
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
|
||||
# volumes:
|
||||
# pgdata:
|
||||
Reference in New Issue
Block a user