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).
This commit is contained in:
Pier-Jean Malandrino 2026-04-03 09:52:22 +02:00
parent aa7c539cc3
commit 48b7d5d3e8
4 changed files with 10 additions and 8 deletions

View file

@ -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

View file

@ -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` | ~23 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 | ~23 GB |
| **Image size** | ~270 MB | ~1.9 GB |
| **Memory** | 2 GB | 6 GB (recommended 8 GB+) |
| **CPUs** | 2 | 4 (recommended 8+) |

View file

@ -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` | ~23 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 | ~23 GB |
| **Image size** | ~270 MB | ~1.9 GB |
| **Memory** | 2 GB | 6 GB (recommended 8 GB+) |
| **CPUs** | 2 | 4 (recommended 8+) |

View file

@ -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