From 48b7d5d3e8e642ffd082203efe3e347754e093d0 Mon Sep 17 00:00:00 2001 From: Pier-Jean Malandrino Date: Fri, 3 Apr 2026 09:52:22 +0200 Subject: [PATCH] Use CPU-only torch in local image to reduce size from 5.8GB to 1.9GB Install torch and torchvision from the CPU-only index before docling to avoid pulling CUDA/nvidia/triton dependencies. Update documentation with measured image sizes (270MB remote, 1.9GB local). --- Dockerfile | 3 ++- README.md | 6 +++--- docs/getting-started.md | 6 +++--- document-parser/Dockerfile | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index a18a14c..a5b1597 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,7 +70,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* COPY document-parser/requirements-local.txt . -RUN pip install --no-cache-dir -r requirements-local.txt +RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu \ + && pip install --no-cache-dir -r requirements-local.txt RUN chown -R appuser:appuser /app ENV CONVERSION_ENGINE=local diff --git a/README.md b/README.md index 0a70625..fda0a1a 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,8 @@ Docling Studio ships two Docker image variants: | Variant | Image tag | Size | Description | |---------|-----------|------|-------------| -| **remote** | `latest-remote` | ~300 MB | Lightweight — delegates to an external [Docling Serve](https://github.com/DS4SD/docling-serve) instance | -| **local** | `latest-local` | ~2–3 GB | Full — runs Docling in-process (downloads ML models on first run) | +| **remote** | `latest-remote` | ~270 MB | Lightweight — delegates to an external [Docling Serve](https://github.com/DS4SD/docling-serve) instance | +| **local** | `latest-local` | ~1.9 GB | Full — runs Docling in-process, CPU-only (downloads ML models on first run) | ### Docker — remote mode (fastest) @@ -214,7 +214,7 @@ We follow [Semantic Versioning](https://semver.org/) with a simplified Git Flow. | | Remote image | Local image | |---|---|---| -| **Image size** | ~300 MB | ~2–3 GB | +| **Image size** | ~270 MB | ~1.9 GB | | **Memory** | 2 GB | 6 GB (recommended 8 GB+) | | **CPUs** | 2 | 4 (recommended 8+) | diff --git a/docs/getting-started.md b/docs/getting-started.md index 8e8bbcf..539dd4f 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -4,8 +4,8 @@ Docling Studio ships two Docker image variants: | Variant | Image tag | Size | Description | |---------|-----------|------|-------------| -| **remote** | `latest-remote` | ~300 MB | Lightweight — delegates to an external [Docling Serve](https://github.com/DS4SD/docling-serve) instance | -| **local** | `latest-local` | ~2–3 GB | Full — runs Docling in-process (downloads ML models on first run) | +| **remote** | `latest-remote` | ~270 MB | Lightweight — delegates to an external [Docling Serve](https://github.com/DS4SD/docling-serve) instance | +| **local** | `latest-local` | ~1.9 GB | Full — runs Docling in-process, CPU-only (downloads ML models on first run) | ## Docker — remote mode (fastest) @@ -117,7 +117,7 @@ All configuration is done via environment variables: | | Remote image | Local image | |---|---|---| -| **Image size** | ~300 MB | ~2–3 GB | +| **Image size** | ~270 MB | ~1.9 GB | | **Memory** | 2 GB | 6 GB (recommended 8 GB+) | | **CPUs** | 2 | 4 (recommended 8+) | diff --git a/document-parser/Dockerfile b/document-parser/Dockerfile index a9c3b17..bb63592 100644 --- a/document-parser/Dockerfile +++ b/document-parser/Dockerfile @@ -47,7 +47,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* COPY requirements-local.txt . -RUN pip install --no-cache-dir -r requirements-local.txt +RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu \ + && pip install --no-cache-dir -r requirements-local.txt RUN chown -R appuser:appuser /app USER appuser