feat: 添加Docker部署配置

Dockerfile: 多阶段构建, CPU版PyTorch, 模型预加载

docker-compose: 健康检查, 数据卷持久化, 环境变量注入

requirements.lock.txt: 锁定依赖版本确保构建可复现
This commit is contained in:
2026-04-18 09:32:58 +08:00
parent 78bf3862ab
commit 4c439d2d7e
4 changed files with 95 additions and 0 deletions

20
docker-compose.yml Normal file
View File

@@ -0,0 +1,20 @@
services:
llm-compass:
build: .
container_name: llm-compass
ports:
- "8000:8000"
environment:
- DASHSCOPE_API_KEY=${DASHSCOPE_API_KEY}
volumes:
- compass-data:/app/data
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
volumes:
compass-data: