From 15d42315edd5ce615b2dae1a30e52efec64fbf11 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 7 Feb 2026 07:38:28 -0800 Subject: [PATCH] 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 --- docker-compose.yml | 4 +--- packages/services/docling-service/Dockerfile | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 92b194a..1d03da1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -256,12 +256,10 @@ services: dockerfile: Dockerfile container_name: iconsulting-docling restart: unless-stopped - environment: - HF_HOME: /models/huggingface ports: - "3007:3007" volumes: - - docling_models:/models + - docling_models:/root/.cache/huggingface healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3007/health')"] interval: 30s diff --git a/packages/services/docling-service/Dockerfile b/packages/services/docling-service/Dockerfile index 1ec6503..3c77020 100644 --- a/packages/services/docling-service/Dockerfile +++ b/packages/services/docling-service/Dockerfile @@ -13,9 +13,8 @@ RUN pip install --no-cache-dir -r requirements.txt COPY app/ ./app/ COPY scripts/ ./scripts/ -# 模型缓存目录(运行时通过 Docker volume 持久化到 /models) -# 构建时预下载到镜像默认路径;运行时 HF_HOME=/models/huggingface 由 volume 接管 -ENV HF_HOME=/root/.cache/huggingface +# 构建时预下载模型到 /root/.cache/huggingface(HF 默认路径) +# 运行时通过 Docker volume 持久化该目录,首次启动从镜像初始化 volume RUN python scripts/preload_models.py || echo "Model preload skipped (will download on first request)" EXPOSE 3007