hyf-backend/scripts/DOCKER.md

42 lines
1018 B
Markdown
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.

# Docker 部署说明
## 快速启动
```bash
# 构建并启动
docker compose up -d --build
# 首次部署需创建 pgvector 扩展(若使用向量检索)
docker exec -it pgvector-db psql -U drgraph -d th_agenter -c "CREATE EXTENSION IF NOT EXISTS vector;"
# 执行数据库迁移(首次或模型变更后)
docker exec -it hyf-backend alembic upgrade head
```
## 服务说明
| 服务 | 端口 | 说明 |
|------|------|------|
| app | 8000 | FastAPI 后端 |
| db | 5432 | PostgreSQL + pgvector |
## 数据持久化
- `./data/uploads` - 知识库上传文件
- `./data/chroma` - 向量数据库Chroma 本地存储)
- `./webIOs/output/logs` - 应用日志
## 环境变量
通过 `docker-compose.yml``environment``.env` 文件配置,常用:
- `DATABASE_URL` - 数据库连接compose 已默认配置)
- `SECRET_KEY` - JWT 密钥(生产务必修改)
- 大模型 API 密钥等(见 `.env.example`
## 仅构建镜像
```bash
docker build -t hyf-backend:latest .
```