# SPDX-FileCopyrightText: 2023 James R. Barlow # SPDX-License-Identifier: MPL-2.0 # Note: Alpine 3.20 builds tesseract with --enable-opencl, which is not # supported by anyone. OCRmyPDF is not compatible with Alpine 3.20.0 # through 3.20.3. The Alpine issue should be fixed in 3.21.0. It is # not clear if 3.20.4+ will have the fix. # Details # https://gitlab.alpinelinux.org/alpine/aports/-/issues/16143 # https://github.com/ocrmypdf/OCRmyPDF/issues/1395 FROM alpine:3.19 AS base ENV LANG=C.UTF-8 ENV TZ=UTC RUN apk add --no-cache \ python3 \ zlib FROM base AS builder RUN apk add --no-cache \ ca-certificates \ git \ python3-dev \ curl COPY . /app WORKDIR /app RUN curl -LsSf https://astral.sh/uv/0.4.27/install.sh | sh ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy # Instead of restarting the shell, use uv directly from its installed location. RUN /root/.cargo/bin/uv sync --extra test --extra webservice --extra watcher FROM base RUN apk add --no-cache \ ghostscript \ jbig2dec \ jbig2enc \ pngquant \ tesseract-ocr \ tesseract-ocr-data-chi_sim \ tesseract-ocr-data-deu \ tesseract-ocr-data-eng \ tesseract-ocr-data-fra \ tesseract-ocr-data-osd \ tesseract-ocr-data-por \ tesseract-ocr-data-spa \ ttf-droid \ unpaper \ && rm -rf /var/cache/apk/* WORKDIR /app COPY --from=builder --chown=app:app /app /app ENV PATH="/app/.venv/bin:${PATH}" ENTRYPOINT ["/app/.venv/bin/ocrmypdf"]