更新技术实施方案和PRD文档版本历史
This commit is contained in:
65
backend/docker-compose.yml
Normal file
65
backend/docker-compose.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
# Docker Compose配置文件 - 活牛采购智能数字化系统后端
|
||||
|
||||
# 全局配置
|
||||
x-common-config:
|
||||
&common-config
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
# 服务定义
|
||||
services:
|
||||
# 后端Node.js应用服务
|
||||
backend:
|
||||
<<: *common-config
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: niumall-backend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "4330:4330"
|
||||
environment:
|
||||
# 数据库配置 - 使用外部数据库
|
||||
DB_USERNAME: ${DB_USERNAME}
|
||||
DB_PASSWORD: ${DB_PASSWORD}
|
||||
DB_NAME: ${DB_NAME}
|
||||
DB_HOST: ${DB_HOST}
|
||||
DB_PORT: ${DB_PORT}
|
||||
|
||||
# Redis配置 - 使用外部Redis
|
||||
REDIS_HOST: ${DB_HOST}
|
||||
REDIS_PORT: 6379
|
||||
|
||||
# 服务器配置
|
||||
PORT: 4330
|
||||
NODE_ENV: production
|
||||
|
||||
# JWT配置
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
JWT_EXPIRES_IN: 24h
|
||||
|
||||
# 日志配置
|
||||
LOG_LEVEL: info
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
depends_on:
|
||||
# 不再依赖内部数据库和Redis容器,改为使用外部服务
|
||||
wait-for-db:
|
||||
condition: service_completed_successfully
|
||||
|
||||
# 等待数据库连接测试服务
|
||||
wait-for-db:
|
||||
image: busybox:latest
|
||||
container_name: wait-for-db
|
||||
command: ["sh", "-c", "sleep 5 && echo '数据库连接等待完成'"]
|
||||
environment:
|
||||
DB_HOST: ${DB_HOST}
|
||||
DB_PORT: ${DB_PORT}
|
||||
|
||||
# 数据卷配置
|
||||
volumes:
|
||||
logs:
|
||||
driver: local
|
||||
Reference in New Issue
Block a user