From e131e3ce125724c0629d161cc18bf510ea9cc143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Fri, 18 Oct 2024 16:23:03 +0200 Subject: [PATCH] feat: add pymupdf/mutool --- executor/Dockerfile | 10 ++++++++++ executor/requirements-skip.txt | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/executor/Dockerfile b/executor/Dockerfile index 06408eb..9af612b 100644 --- a/executor/Dockerfile +++ b/executor/Dockerfile @@ -16,6 +16,7 @@ ARG GO_VERSION="1.23" ARG UPM_VERSION="2.5.2" ARG ALPINE_VERSION="3.20" ARG RUST_VERSION="1.81" +ARG PYTHON_VERSION="3.12" ARG UID="1001050000" FROM docker.io/rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS build-executor-server @@ -35,6 +36,10 @@ RUN apk add --no-cache git make gcc g++ musl-dev && \ export CGO_CFLAGS="-D_LARGEFILE64_SOURCE" && \ make install +FROM docker.io/alpine:${ALPINE_VERSION} AS build-pymupdf +RUN apk add --no-cache gcc musl-dev linux-headers make g++ clang-dev python3 python3-dev py3-pip && \ + pip install --target /out pymupdf + FROM docker.io/alpine:${ALPINE_VERSION} AS runtime RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \ bash \ @@ -42,6 +47,7 @@ RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/t ffmpeg \ ghostscript-fonts \ imagemagick \ + mupdf-tools \ opencv \ pandoc-cli \ python3 \ @@ -111,6 +117,10 @@ COPY --from=build-upm /go/bin/upm /usr/local/bin/upm COPY --from=build-upm /workdir/upm/internal/backends/python/pypi_map.sqlite /pypi_map.sqlite ENV PYPI_MAP_DB=/pypi_map.sqlite +# pymupdf +ARG PYTHON_VERSION +COPY --from=build-pymupdf /out/. /venv/lib/python${PYTHON_VERSION}/site-packages/ + # Executor server COPY --from=build-executor-server /workdir/target/release/executor-server /usr/local/bin/executor-server diff --git a/executor/requirements-skip.txt b/executor/requirements-skip.txt index 3ffb867..4b92189 100644 --- a/executor/requirements-skip.txt +++ b/executor/requirements-skip.txt @@ -1,2 +1,4 @@ ffmpeg # actually ffmpeg-python -opencv-python # installed through OS package \ No newline at end of file +opencv-python # installed through OS package +pymupdf # installed manually +fitz # part of pymupdf \ No newline at end of file