-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.extract
More file actions
27 lines (23 loc) · 1.43 KB
/
Copy pathDockerfile.extract
File metadata and controls
27 lines (23 loc) · 1.43 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
# Image for source preparation: PDF -> Markdown (with OCR for scanned pages).
# Separate from the slim builder image; runs only once per new source.
FROM python:3.12-slim
# Tesseract OCR. English data ships with tesseract-ocr; German is added as an
# example — append your languages here (e.g. tesseract-ocr-fra, tesseract-ocr-spa)
# and pass them at runtime via ./tools/extract.sh ... --lang eng+fra
# DL3008 ignored on purpose: pinning apt versions against Debian's rolling repos
# breaks the build once the pinned version is dropped upstream. The deps that
# affect card OUTPUT are the pinned pip packages below, not the OCR binary.
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install -y --no-install-recommends tesseract-ocr tesseract-ocr-deu \
&& rm -rf /var/lib/apt/lists/*
# tessdata path so PyMuPDF's OCR reliably finds the language data.
ENV TESSDATA_PREFIX=/usr/share/tesseract-ocr/5/tessdata
# PDF->Markdown (pymupdf4llm pulls in PyMuPDF, which ships the Tesseract binding).
# Pinned: an upstream release can silently change extraction/marker output that
# the whole pipeline parses. PyMuPDF pinned too — extract.py imports `fitz`
# directly. Bump both together (they are released in lockstep) after checking.
RUN pip install --no-cache-dir "pymupdf4llm==1.27.2.3" "PyMuPDF==1.27.2.3"
# The project is mounted to /work at runtime (script changes take effect immediately).
WORKDIR /work
ENTRYPOINT ["python", "/work/tools/extract.py"]