Files
syops/docker-compose.yml
T

65 lines
2.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.
services:
# ==============================================================================
# hxops-backend: Flask 后端服务 (端口: 5000)
# ==============================================================================
hxops-backend:
image: ${BACKEND_IMAGE:-hxops-backend:local}
build:
context: .
dockerfile: backend/Dockerfile
container_name: hxops-backend
restart: always
# 与 scripts/deploy_compose.sh 使用的 .env.<ENV_NAME> 对齐(通过 COMPOSE_ENV_BASENAME)
env_file:
- ${COMPOSE_ENV_BASENAME:-.env.dev}
environment:
# 数据库连接 (在环境变量中配置)
- DATABASE_URL=${DATABASE_URL}
- FLASK_APP=${FLASK_APP:-run.py}
- FLASK_ENV=${FLASK_ENV:-production}
- ORACLE_CLIENT_LIB_DIR=${ORACLE_CLIENT_LIB_DIR:-/app/oracle_client}
- ORACLE_HOME=/app/oracle_client/instantclient_19_31
- LD_LIBRARY_PATH=/app/oracle_client/instantclient_19_31:/app/oracle_client
# 允许容器访问宿主机服务 (如数据库)
extra_hosts:
- "host.docker.internal:host-gateway"
# 如果需要在宿主机调试,可暴露端口;生产环境建议只在网络内暴露
ports:
- "5052:5052"
# 持久化运行时可写文件:
# - backend/.env 用于保存管理员后台修改的企业微信等配置(与数据库双写,
# 防止容器重建后从镜像基线读取丢失修改)。文件不存在时 docker 会自动
# 把它当作目录挂载,因此先确保宿主机上存在该文件再启动。
volumes:
- ./backend/.env:/app/.env
- ./oracle_client:/app/oracle_client:ro
networks:
- ai-platform
# ==============================================================================
# hxops-frontend: Vue 前端静态资源 + Nginx 反向代理 (端口: 80)
# ==============================================================================
hxops-frontend:
image: ${FRONTEND_IMAGE:-hxops-frontend:local}
build:
context: ./frontend
dockerfile: Dockerfile
container_name: hxops-frontend
restart: always
depends_on:
- hxops-backend
# 前端容器暴露 80 端口,映射到宿主机 8890 (或其他端口供 nginx-gateway 访问)
ports:
- "8890:80"
networks:
- ai-platform
# ==============================================================================
# 网络配置
# ==============================================================================
networks:
ai-platform:
name: ai-platform
driver: bridge