Files
OCR/deploy/1panel/README.md
egg 86a6633000 feat: consolidate env config and add deployment files
- Add debug_font_path, demo_docs_dir, e2e_api_base_url to config.py
- Fix hardcoded paths in pp_structure_debug.py, create_demo_images.py
- Fix hardcoded paths in test files
- Update .env.example with new configuration options
- Update .gitignore to exclude AI development files (.claude/, openspec/, AGENTS.md, CLAUDE.md)
- Add production startup script (start-prod.sh)
- Add README.md with project documentation
- Add 1panel Docker deployment files (docker-compose.yml, Dockerfiles, nginx.conf)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 15:02:16 +08:00

126 lines
2.2 KiB
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.

# Tool_OCR - 1Panel Docker 佈署指南
本目錄包含 1Panel 平台的 Docker 佈署配置。
## 前置需求
- Docker 20.10+
- Docker Compose 2.0+
- NVIDIA Container ToolkitGPU 加速)
- MySQL 8.0+(外部資料庫)
## 佈署步驟
### 1. 配置環境變數
```bash
# 複製環境變數範本
cp .env.example .env
# 編輯配置
nano .env
```
必要配置項:
- `MYSQL_*` - 資料庫連線設定
- `SECRET_KEY` - JWT 簽名金鑰(使用 `openssl rand -hex 32` 生成)
- `DIFY_*` - 翻譯 API 設定
### 2. 建置映像
```bash
# 建置所有服務
docker-compose build
# 或分別建置
docker-compose build backend
docker-compose build frontend
```
### 3. 啟動服務
```bash
# 啟動所有服務
docker-compose up -d
# 查看日誌
docker-compose logs -f
# 查看狀態
docker-compose ps
```
### 4. 存取服務
- 前端介面http://your-server:12010
- API 文件http://your-server:8000/docs
- 健康檢查http://your-server:8000/health
## 服務管理
```bash
# 停止服務
docker-compose down
# 重啟服務
docker-compose restart
# 更新服務
docker-compose pull
docker-compose up -d --build
# 查看資源使用
docker stats
```
## 資料持久化
以下 Docker volumes 會自動建立:
| Volume | 用途 |
|--------|------|
| `tool_ocr_uploads` | 上傳檔案 |
| `tool_ocr_storage` | 處理結果 |
| `tool_ocr_logs` | 應用日誌 |
| `tool_ocr_models` | OCR 模型快取 |
## GPU 加速
預設配置會使用 NVIDIA GPU。如果不需要 GPU 加速,請修改 `docker-compose.yml`,移除 `deploy.resources.reservations` 區塊。
## 常見問題
### Q: 服務啟動失敗?
檢查日誌:
```bash
docker-compose logs backend
docker-compose logs frontend
```
### Q: 資料庫連線失敗?
確認:
1. MySQL 服務正在運行
2. 防火牆允許連接
3. 使用者權限正確
### Q: GPU 不可用?
確認 NVIDIA Container Toolkit 已安裝:
```bash
nvidia-smi
docker run --rm --gpus all nvidia/cuda:11.8.0-base-ubuntu22.04 nvidia-smi
```
## 1Panel 整合
在 1Panel 中:
1. 進入「應用商店」→「自訂應用」
2. 上傳此目錄的所有檔案
3. 配置環境變數
4. 點擊「安裝」
或使用 1Panel 的「容器」功能直接導入 `docker-compose.yml`