diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 4253a9d..b71a909 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -93,9 +93,6 @@ services: - ./document-parser:/app - uploads_data:/app/uploads - db_data:/app/data - # Persists Docling / HF model checkpoints across container restarts so - # the first conversion does not re-download every cold start. - - hf_cache:/home/appuser/.cache/huggingface environment: CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000,http://localhost:5173} DOCLING_SERVE_URL: ${DOCLING_SERVE_URL:-} @@ -143,4 +140,3 @@ volumes: uploads_data: db_data: frontend_node_modules: - hf_cache: diff --git a/docker-compose.yml b/docker-compose.yml index 85eaabb..e98eec5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -99,9 +99,6 @@ services: volumes: - uploads_data:/app/uploads - db_data:/app/data - # Persists Docling / HF model checkpoints across container restarts so - # the first conversion does not re-download every cold start. - - hf_cache:/home/appuser/.cache/huggingface environment: CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000,http://localhost:5173} DOCLING_SERVE_URL: ${DOCLING_SERVE_URL:-} @@ -136,4 +133,3 @@ volumes: neo4j_logs: uploads_data: db_data: - hf_cache: diff --git a/document-parser/Dockerfile b/document-parser/Dockerfile index 3d0597d..fd2e5a2 100644 --- a/document-parser/Dockerfile +++ b/document-parser/Dockerfile @@ -97,5 +97,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ USER appuser COPY --from=builder-local --chown=appuser:appuser /opt/venv /opt/venv + +# Pre-fetch Docling model checkpoints into the appuser HF cache so the very +# first conversion does not pay the ~400 MB cold-start download. Opt out +# with --build-arg BAKE_MODELS=false for an even smaller image (will then +# download on first request). +ARG BAKE_MODELS=true +RUN if [ "$BAKE_MODELS" = "true" ]; then \ + docling-tools models download; \ + fi + COPY --chown=appuser:appuser . /app ENV CONVERSION_ENGINE=local