-
Notifications
You must be signed in to change notification settings - Fork 382
feat: Add Dockerfile for docling-serve #1235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 \ | ||
| && 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"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apt-get installhere omits--no-install-recommends(used in production Dockerfiles likeDockerfile.backend) and includeslibxrender-dev(a build-time -dev package) which unnecessarily increases image size for a runtime container. Consider adding--no-install-recommendsand switching to the runtime library package where possible.