Commit graph

160 commits

Author SHA1 Message Date
Your Name
23d886817a chore: bump version to v0.1.17 (CPU-only build) 2026-01-25 20:17:18 +08:00
Your Name
18e97ecef9 feat: 改用 CPU-only MinerU,大幅減少 image 大小(~3-5GB)
- Dockerfile: 將 mineru[all] 改為 mineru,移除 PyTorch CUDA 依賴
- Dockerfile.full: 新增 GPU 加速選項(PyTorch CUDA)供進階用戶啟用
- 預估 image 大小從 10-14GB 降至 3-5GB
- MinerU 仍可正常運行(使用 pipeline backend)
2026-01-25 20:10:03 +08:00
Your Name
906f112999 fix(docker): replace python3 -c with heredoc scripts to fix IndentationError 2026-01-25 13:43:49 +08:00
Your Name
a9b1fc5699 fix: revert to v0.1.16, remove incorrect documentation 2026-01-25 13:23:14 +08:00
Your Name
e862cb6667 docs: add Dockerfile refactoring documentation v0.1.17 2026-01-25 13:17:43 +08:00
Your Name
8867eef33e chore: 更新 Dockerfile 版本至 v0.1.17 2026-01-25 13:16:29 +08:00
Your Name
55b0f519ab refactor(docker): 完整重構 Dockerfile v0.1.16
BREAKING CHANGE: Dockerfile 結構重新設計

## 重構內容

### Multi-Stage Build 結構
- Stage 1 [base]: Bun runtime 基礎
- Stage 2 [install]: Node 依賴安裝
- Stage 3 [prerelease]: 應用程式建構
- Stage 4 [system-tools]: APT 系統工具(拆分為 14 個獨立 RUN)
- Stage 5 [fonts]: 字型安裝
- Stage 6 [python-tools]: Python CLI 工具(拆分為 9 個獨立 RUN)
- Stage 7 [models]: 模型下載
- Stage 8 [release]: 最終 Image

### 新增 Scripts
- install-system-tools.sh: 系統工具安裝
- install-fonts.sh: 字型安裝
- install-python-tools.sh: Python 工具安裝
- download-models.sh: 模型下載
- verify-installation.sh: 完整安裝驗證

### 刪除舊檔案
- Dockerfile.backup
- Dockerfile.offline
- Dockerfile.old

### 路徑更新
- MinerU 模型: /opt/convertx/models/mineru/PDF-Extract-Kit-1.0
- BabelDOC 快取: /root/.cache/babeldoc

### Multi-Arch 支援
- linux/amd64: 功能完整
- linux/arm64: 安全降級(MinerU/resvg 跳過)

Closes #docker-refactor
2026-01-25 13:15:31 +08:00
Your Name
e43649bc96 fix: add python3-dev for pykcs11 and fix indentation 2026-01-25 11:30:53 +08:00
Your Name
d03d084294 fix: 添加 --break-system-packages 修復 uv pip install 2026-01-25 11:16:46 +08:00
Your Name
367e0d3056 feat: 完全離線化 Dockerfile v0.1.16
## 主要修復
- MinerU: 改用 system-level 安裝 (uv pip install --system)
- MinerU: 模型下載到固定目錄 /opt/mineru/models
- BabelDOC: 完整 warmup + 離線 cache
- PDFMathTranslate: ONNX 模型使用 COPY 指令
- ImageMagick: 確保已安裝

## 結構優化
- Multi-Stage Build (8 stages)
- 使用 heredoc 語法處理多行 Python
- 分階段安裝避免記憶體尖峰

## Runtime 離線模式
- HF_HOME=/nonexistent
- HF_HUB_OFFLINE=1
- BABELDOC_OFFLINE=1
- PIP_NO_INDEX=1

## 新增驗證腳本
- scripts/verify-offline.sh
2026-01-25 11:07:03 +08:00
Your Name
b23d42a7b1 fix(docker): 修復三個關鍵問題
1. pykcs11 編譯失敗:安裝 build-essential, swig, libpcsclite-dev
2. MinerU 模型 cache 問題:模型移動到 /opt/mineru/models/ 固定目錄
   - 不再依賴 HF cache(可安全刪除)
   - mineru.json 指向固定目錄
3. 修復驗證邏輯縮排錯誤

CACHE_BUST: 5
2026-01-25 10:46:22 +08:00
Your Name
0b1ecb7b40 fix(docker): 拆分 RUN 指令,移除 pipx fallback,修復 MinerU 安裝
- 將統一的大型 RUN 拆分成 8 個獨立的 RUN 指令
- MinerU 使用單獨的 RUN 指令(階段 12E)
- 移除 pipx 安裝方式(因 pipx 安裝到 ~/.local/bin 不在 PATH)
- 只使用 system-level 安裝:uv pip install --system 或 pip3 --break-system-packages
- 增加 CACHE_BUST 到 4

Fixes: MinerU 安裝驗證失敗問題
2026-01-25 10:39:00 +08:00
Your Name
f7430107b7 fix: 修復 MinerU 安裝失敗問題,使用 uv pip install(官方推薦方式)
- 改用 uv pip install 替代 pipx install(MinerU 官方推薦)
- 增加至 4 種安裝方法重試
- 增加詳細診斷資訊輸出
- 更新 CACHE_BUST 強制重建
2026-01-25 10:25:59 +08:00
Your Name
688e30abc3 fix: 增加 MinerU 安裝重試等待時間,改善安裝穩定性 2026-01-25 00:43:15 +08:00
Your Name
910250caee fix: MinerU 安裝增加重試機制和備用方法
- 方法 1: pipx install(標準方式)
- 方法 2: pipx install 重試(等待 5 秒後)
- 方法 3: pip3 install(備用方式)
- amd64 必須成功安裝,否則 build 失敗
2026-01-25 00:41:35 +08:00
Your Name
81b82006f0 fix: 預存 ONNX 模型於儲存庫,避免 build 時下載失敗
- 將 DocLayout-YOLO ONNX 模型 (72MB) 預下載到 models/ 目錄
- 使用 COPY 指令複製模型,無需 runtime 下載
- 更新驗證邏輯,跳過已預置的資源驗證
- 添加 CACHE_BUST 到 GitHub Actions workflows
2026-01-25 00:26:44 +08:00
Your Name
0f5bf46111 fix: 新增 CACHE_BUST 參數以強制重新執行模型下載層,改善下載穩定性 2026-01-25 00:22:46 +08:00
Your Name
4b0f77aa2d fix: 預存字型檔案於儲存庫,避免 build 時下載失敗 2026-01-25 00:02:09 +08:00
Your Name
3a7c049818 fix: 修正字型檔案驗證邏輯,確保檔案存在及大小符合要求 2026-01-24 23:48:37 +08:00
Your Name
f2c5997847 fix: use huggingface_hub for ONNX download and add CACHE_BUST
- Use huggingface_hub.hf_hub_download() instead of curl (supports xet storage)
- Add CACHE_BUST ARG to force fresh downloads after cache delete
- Add font file size validation after download
- Re-enable registry cache (buildcache tag deleted manually)
- ARM64 graceful degradation for MinerU
2026-01-24 23:46:44 +08:00
Your Name
2d28665714 fix: 修復 ONNX 模型下載(使用 huggingface_hub 支援 xet 格式)
- 使用 huggingface_hub.hf_hub_download 替代 curl 下載 ONNX 模型
- 增加字型下載的超時和重試設定
- ARM64 架構優雅跳過 MinerU 模型下載
- 驗證邏輯對 ARM64 更寬容,僅 amd64 強制驗證
- 確保 linux/amd64 開箱即用,無運行時模型下載
2026-01-24 23:25:34 +08:00
Your Name
d3aa8e5fee fix: 修正 Dockerfile 中的輸出格式,統一縮排以提高可讀性 2026-01-24 21:49:29 +08:00
Your Name
cc8df3c91d fix: shell syntax for strict model validation in Dockerfile
- Change 'set -eux' to 'set -eu' (remove -x for cleaner logs)
- Fix if statement syntax for set -e compatibility
- Add proper && chaining inside if blocks
- Add fallback echo values for numeric comparisons
2026-01-24 21:42:46 +08:00
Your Name
27ffdee6f4 fix: Docker image size and add download retry mechanism
## Bug Fixes
- Fix standard image size issue (was ~1.5GB, should be 8-12GB)
- Add strict model validation during build
- Add retry mechanism (--retry 3 --retry-delay 5) to all curl downloads

## Documentation
- Clarify version terminology: Standard (一般版), Extended (擴充版), Lite (Lite版)
- Remove duplicate docs/環境變數總覽.md
- Improve environment variable documentation structure
- Add quick reference tables for environment variables

## Build
- Explicitly specify 'file: Dockerfile' in release.yml
- Use 'buildcache-full' cache key to prevent cross-pollution
2026-01-24 21:31:11 +08:00
Your Name
944fe18b75 Add unit tests for PDF Packager converter functionality
- Implement tests for converter properties, ensuring correct input and output formats.
- Add tests for chip parsing, covering various image, pdf_image, and pdfa chip formats.
- Include tests for the isArchiveOutput and getOutputFileName functions.
- Mock execFile for testing the convert function, verifying command execution and output file creation.
- Ensure all chips are parseable and validate the completeness of chip categories.
2026-01-24 14:39:22 +08:00
Your Name
cb0ea8b578 fix: add xauth package for xvfb-run support 2026-01-24 12:04:36 +08:00
Your Name
ef3bf66cce feat: 新增 deark 引擎支援解包/解析多種格式
- 新增 deark 轉換器 (src/converters/deark.ts)
- 支援 100+ 種輸入格式(壓縮檔、舊圖片、字型、可執行檔資源等)
- 輸出為 .tar 封裝
- Dockerfile 添加 deark 從源碼編譯安裝
- 更新 main.ts 註冊新引擎
- 添加單元測試 (tests/converters/deark.test.ts)
- 更新文件 (docs/功能說明/轉換器.md)
- CI/CD 添加 deark 版本驗證
2026-01-23 23:33:26 +08:00
Your Name
a06df23b1d feat: 新增 OCRmyPDF 轉換引擎 (v0.1.14)
## 新功能
- OCRmyPDF 轉換引擎:將掃描版 PDF 轉換為可搜尋 PDF
  - 支援 7 種語言:en, zh-TW, zh, ja, ko, de, fr
  - 與 PDFMathTranslate 風格一致的 UI 格式 (pdf-<lang>)
  - 自動偵測頁面方向並旋轉
  - 自動校正傾斜
  - 跳過已有文字層的頁面
  - 詳細的 5 階段處理進度輸出

## 建置
- Dockerfile:安裝 ocrmypdf 與 Tesseract OCR 語言包

## 文件
- 更新 OCR 功能文件
- 文件目錄結構改為中文名稱

## 測試
- 修復 BabelDOC 和 PDFMathTranslate 測試的 OCR mock
- 所有 345 個測試通過
2026-01-23 16:28:33 +08:00
Your Name
3457311f14 refactor: 整理環境變數
- 移除重複的環境變數定義
- 統一放置在 Dockerfile 結尾
- 分類整理:Locale、Headless、翻譯服務、離線模式、應用程式
- 添加清晰的註解說明每個變數用途
2026-01-23 12:04:28 +08:00
Your Name
e084d68b95 fix: 增強 headless 環境支援
- 添加 QT_QPA_PLATFORM=offscreen 環境變數
- 添加 DISPLAY=:99 環境變數
- Calibre 轉換器使用 xvfb-run 包裝
- 添加 CALIBRE_USE_SYSTEM_THEME=0

確保 Qt/GTK 應用在無 display 環境下運作
2026-01-23 11:59:47 +08:00
Your Name
0d0c0025fb fix: Inkscape GTK 錯誤 - 使用 xvfb-run 包裝
- 安裝 xvfb 到 Docker image
- 使用 xvfb-run -a 包裝 inkscape 命令
- 設定虛擬螢幕解析度 1024x768x24
- 修復 PNG 轉 SVG 等需要 GTK 的操作

Fixes: Gtk-ERROR Can't create GtkStyleContext without display
2026-01-23 11:57:26 +08:00
Your Name
9fc7217df1 fix: 完善 runtime 離線支援
- 使用 babeldoc --warmup 下載完整資源(模型、字型、cmap、tiktoken)
- 修正驗證邏輯,指向正確的 BabelDOC cache 路徑
- 移除舊的 PDFMATHTRANSLATE_MODELS_PATH 環境變數
- 更新 pdfmathtranslate.ts 使用正確的模型路徑
- 移除手動指定 --onnx 參數(pdf2zh 內部自動處理)

確保所有組件 Runtime 不需要下載任何資源
2026-01-23 11:55:02 +08:00
Your Name
cb8ee290bb fix: 修正 PDFMathTranslate 模型路徑,確保預下載到 babeldoc cache 目錄 2026-01-23 11:48:02 +08:00
Your Name
63f0b57466 chore(release): bump version to 0.1.12 2026-01-23 01:00:18 +08:00
Your Name
26304a295e fix(inkscape): use headless-safe export syntax (--export-type/--export-filename)
Breaking change from Inkscape 1.0+:
- Old syntax: inkscape input.png -o output.svg (triggers GTK init)
- New syntax: inkscape input.png --export-type=svg --export-filename=output.svg

This is the correct headless-safe approach, no need for xvfb.

Ref: https://inkscape.org/doc/inkscape-man.html
2026-01-23 00:01:24 +08:00
Your Name
b5992a84e0 fix(inkscape): use xvfb-run for headless execution
- Inkscape requires X11 display connection, causing 'GtkStyleContext without display' error
- Solution: use xvfb-run to create virtual X11 display
- Fallback: try direct inkscape if xvfb-run fails
- Add xvfb package to Dockerfile
- Update inkscape tests for new xvfb-run behavior

Fixes: Gtk-ERROR: Can't create a GtkStyleContext without a display connection
2026-01-22 23:56:47 +08:00
Your Name
a9867ee97c feat: add Dockerfile for ConvertX-CN v0.1.11 with pre-downloaded models and offline-first design
- Introduced a new Dockerfile that builds the ConvertX-CN image with all necessary dependencies and models pre-downloaded.
- Implemented multi-stage builds to optimize image size and build time.
- Added a script for verifying the integrity of pre-downloaded models and dependencies.
- Ensured the image operates in an offline-first manner, eliminating runtime dependencies on external networks.
2026-01-22 22:17:29 +08:00
Your Name
fd674fac9c fix: 調整 BabelDOC 資源下載邏輯,簡化重試流程並改善錯誤提示 2026-01-22 19:44:26 +08:00
Your Name
e3406a8d04 fix: BabelDOC 改用 generate-offline-assets 方式預下載資源
- 使用 --generate-offline-assets 生成離線包,比 warmup 更穩定
- 添加 10 分鐘超時控制避免無限等待
- 離線包生成後使用 --restore-offline-assets 恢復到快取
- 如果離線包方式失敗,fallback 到 warmup 模式
- 最多重試 3 次,每次失敗後等待 30 秒
- 即使全部失敗,BabelDOC 仍可在 runtime 按需下載
2026-01-22 19:35:04 +08:00
Your Name
37b56aed56 fix: 優化 Dockerfile 中模型下載與快取清理邏輯,減少層差異與空間使用 2026-01-22 19:20:56 +08:00
Your Name
11dc51890c fix: 更新 MinerU 模型下載邏輯,增加設定檔驗證與錯誤處理 2026-01-22 19:10:54 +08:00
Your Name
4ca92e3a22 release: v0.1.11 - BabelDOC 翻譯引擎與穩定性改進
## 新增功能

- BabelDOC PDF 翻譯引擎:支援 PDF/Markdown/HTML 輸出,15 種目標語言

- Dockerfile 更新:pipx 安裝 babeldoc,warmup 預載資源

## 修復

- 修正 user.tsx XSS 安全警告(label 包裹 safe span)

## 品質保證

- 173 個測試全數通過

- TypeScript / ESLint / Prettier / Knip 檢查通過
2026-01-22 17:41:12 +08:00
Your Name
6d4ed58637 fix: 更新 PDFMathTranslate 模型下載方式,使用 snapshot_download 避免硬編碼檔名 2026-01-22 16:27:54 +08:00
Your Name
a5dccccd86 fix: 更新 Dockerfile,修正 huggingface_hub 安裝指令以符合 Debian bookworm 的 PEP 668 要求 2026-01-22 12:33:01 +08:00
Your Name
0f60f3ae14 feat: 更新 Dockerfile 版本,新增模型驗證腳本以確保預下載模型完整性 2026-01-22 10:38:11 +08:00
Your Name
ffb72c531f chore: update Bun version to 1.3.6 in Dockerfiles 2026-01-22 00:58:36 +08:00
Your Name
cac29bfff1 fix: 修正 Dockerfile 中 dasel 和 resvg 安裝步驟的縮排問題 2026-01-21 21:10:33 +08:00
Your Name
947d189b6d fix: 修復 resvg ARM64 無預編譯版本問題
- 更新 resvg repo URL 從 RazrFalcon 到 linebender
- ARM64 架構跳過 resvg 安裝(官方無預編譯版本)
- x86_64 正常安裝 resvg v0.44.0
- ARM64 可使用 ImageMagick/Inkscape 作為 SVG 轉換替代方案
2026-01-21 21:04:40 +08:00
Your Name
4e07cd57aa fix: 修復 bookworm 缺少 dasel 和 resvg 套件的問題
- 從 apt-get install 移除 dasel 和 resvg
- 改用 GitHub releases 下載二進位檔案
- dasel v2.8.1 支援 amd64/arm64
- resvg v0.44.0 支援 amd64/arm64
2026-01-21 20:56:39 +08:00
Your Name
4d2a690bb9 fix: 更新 Dockerfile 版本至 v0.1.10,修正基礎映像為 debian:bookworm,並新增 APT 重試機制以改善 Multi-Arch Build 的穩定性 2026-01-21 20:43:54 +08:00