Files
rag/deploy/docker-compose.yml
lacerate551 42434781f7 chore(deploy): docker-compose 添加源码挂载和 env_file 配置
- 挂载源码目录到容器,支持 git pull + restart 热更新代码
- 添加 env_file 引用项目根目录 .env,解决环境变量缺失问题
- 添加 data/ 目录挂载(SQLite 数据库)
2026-06-05 11:31:44 +08:00

53 lines
1.5 KiB
YAML
Raw Permalink 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.
version: '3.8'
services:
rag-service:
build:
context: ..
dockerfile: deploy/Dockerfile
container_name: rag-service
env_file:
- ../.env
ports:
- "5001:5001"
volumes:
# 数据目录
- ../.data:/app/.data
- ../documents:/app/documents
- ../models:/app/models
- ../data:/app/data
# 源码挂载git pull 后重启即生效,无需重建镜像)
- ../api:/app/api
- ../core:/app/core
- ../knowledge:/app/knowledge
- ../services:/app/services
- ../parsers:/app/parsers
- ../repositories:/app/repositories
- ../storage:/app/storage
- ../auth:/app/auth
- ../config:/app/config
- ../exam_pkg:/app/exam_pkg
- ../deploy/wsgi.py:/app/deploy/wsgi.py
- ../deploy/gunicorn.conf.py:/app/deploy/gunicorn.conf.py
- ../config.py:/app/config.py
- ../main.py:/app/main.py
- ../requirements.txt:/app/requirements.txt
- ../requirements-prod.txt:/app/requirements-prod.txt
environment:
- APP_ENV=prod
restart: unless-stopped
# 资源限制Embedding模型加载需要较多内存
shm_size: '256m' # Gunicorn 心跳文件需要
deploy:
resources:
limits:
memory: 6G
reservations:
memory: 2G
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:5001/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s # 给启动和模型加载留出时间