Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Dockerfile.docling_serve
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim

WORKDIR /app

# System deps (needed for OCR + OpenCV)
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libgl1 \
libsm6 \
libxext6 \
libxrender-dev \
Comment on lines +6 to +11
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apt-get install here omits --no-install-recommends (used in production Dockerfiles like Dockerfile.backend) and includes libxrender-dev (a build-time -dev package) which unnecessarily increases image size for a runtime container. Consider adding --no-install-recommends and switching to the runtime library package where possible.

Suggested change
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libgl1 \
libsm6 \
libxext6 \
libxrender-dev \
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libgl1 \
libsm6 \
libxext6 \
libxrender1 \

Copilot uses AI. Check for mistakes.
&& rm -rf /var/lib/apt/lists/*

# Install docling-serve with all extras
RUN uv pip install --system \
"docling-serve[ui]==1.5.0" \
onnxruntime \
easyocr \
"docling[easyocr,rapidocr,vlm]" \
"docling-core==2.48.1" \
opencv-python-headless

# Set global model cache directories so any user running the container can access them
ENV HF_HOME=/app/models/huggingface \
EASYOCR_MODULE_PATH=/app/models/easyocr

# Pre-download all models (EasyOCR, Docling Layout, VLM) into global directories
RUN mkdir -p /app/models && \
python -c "import easyocr; easyocr.Reader(['en']); from docling.document_converter import DocumentConverter; from docling.datamodel.document import InputFormat; converter = DocumentConverter(); converter.format_to_options[InputFormat.PDF].pipeline_options.do_picture_description = True; converter.initialize_pipeline(InputFormat.PDF)" && \
chmod -R 777 /app/models

# Expose port
EXPOSE 5001

# Start server
CMD ["docling-serve", "run", "--host", "0.0.0.0", "--port", "5001", "--workers", "2", "--enable-ui"]
Loading