-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (35 loc) · 1.67 KB
/
Copy pathDockerfile
File metadata and controls
37 lines (35 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# docling-serve — container image for the HTTP conversion API.
#
# Build (from the repository root):
# docker build -f crates/docling-serve/Dockerfile -t docling-serve .
#
# Run. The ML assets (ONNX models + pdfium) are fetched into the image by
# `download_dependencies.sh` at build time; to keep the image slim instead,
# build with `--build-arg FETCH_ASSETS=0` and mount them:
# docker run -p 5001:5001 docling-serve
# docker run -p 5001:5001 -v ./models:/app/models -v ./.pdfium:/app/.pdfium docling-serve
#
# The server binds 0.0.0.0 inside the container (the container boundary is the
# network policy); URL fetching is enabled — front with a policy proxy or add
# --no-url-fetch to CMD if the service should accept uploads only.
FROM rust:1.96-bookworm AS build
WORKDIR /src
COPY . .
ARG FETCH_ASSETS=1
RUN cargo build --release -p docling-serve --locked
RUN if [ "$FETCH_ASSETS" = "1" ]; then sh scripts/install/download_dependencies.sh; \
else mkdir -p models .pdfium; fi
FROM debian:bookworm-slim
# ffmpeg powers video frame sampling (#138 Phase 2); without it a video input
# still converts, transcript-only.
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates ffmpeg \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /src/target/release/docling-serve /usr/local/bin/docling-serve
# Assets resolve relative to the working directory (`models/`, `.pdfium/lib`).
COPY --from=build /src/models ./models
COPY --from=build /src/.pdfium ./.pdfium
ENV PDFIUM_DYNAMIC_LIB_PATH=/app/.pdfium/lib
EXPOSE 5001
# Liveness: GET /health; readiness: GET /ready (503 until --warmup finishes).
CMD ["docling-serve", "--addr", "0.0.0.0:5001", "--warmup"]