fix(docling): align volume mount with HF default cache path

Build preloads models to /root/.cache/huggingface (HF default).
Volume must mount there too, not a separate /models path.
Remove HF_HOME env override to keep paths consistent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-07 07:38:28 -08:00
parent 9b357fe01c
commit 15d42315ed
2 changed files with 3 additions and 6 deletions

View File

@ -256,12 +256,10 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: iconsulting-docling container_name: iconsulting-docling
restart: unless-stopped restart: unless-stopped
environment:
HF_HOME: /models/huggingface
ports: ports:
- "3007:3007" - "3007:3007"
volumes: volumes:
- docling_models:/models - docling_models:/root/.cache/huggingface
healthcheck: healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3007/health')"] test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3007/health')"]
interval: 30s interval: 30s

View File

@ -13,9 +13,8 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY app/ ./app/ COPY app/ ./app/
COPY scripts/ ./scripts/ COPY scripts/ ./scripts/
# 模型缓存目录(运行时通过 Docker volume 持久化到 /models # 构建时预下载模型到 /root/.cache/huggingfaceHF 默认路径)
# 构建时预下载到镜像默认路径;运行时 HF_HOME=/models/huggingface 由 volume 接管 # 运行时通过 Docker volume 持久化该目录,首次启动从镜像初始化 volume
ENV HF_HOME=/root/.cache/huggingface
RUN python scripts/preload_models.py || echo "Model preload skipped (will download on first request)" RUN python scripts/preload_models.py || echo "Model preload skipped (will download on first request)"
EXPOSE 3007 EXPOSE 3007