Files
ocrmypdf/.docker/Dockerfile
T

81 lines
1.8 KiB
Docker
Raw Normal View History

2015-08-18 04:46:25 -07:00
# OCRmyPDF
#
2019-05-28 15:36:50 -07:00
2022-04-28 22:46:30 -07:00
FROM ubuntu:22.04 as base
2019-05-28 15:36:50 -07:00
ENV LANG=C.UTF-8
2021-07-15 23:12:38 -07:00
ENV TZ=UTC
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
libqpdf-dev \
zlib1g \
liblept5
2021-07-15 23:12:38 -07:00
FROM base as builder
2015-08-18 04:46:25 -07:00
2021-11-13 00:06:35 -08:00
# Note we need leptonica here to build jbig2
2015-08-18 04:46:25 -07:00
RUN apt-get update && apt-get install -y --no-install-recommends \
2018-07-10 18:20:33 -07:00
build-essential autoconf automake libtool \
2018-07-11 00:17:04 -07:00
libleptonica-dev \
2018-07-11 00:56:55 -07:00
zlib1g-dev \
2021-04-05 01:38:48 -07:00
python3-dev \
2019-11-16 15:21:45 -08:00
python3-distutils \
2021-04-05 01:38:48 -07:00
libffi-dev \
2019-11-16 15:21:45 -08:00
ca-certificates \
curl \
2019-05-28 15:36:50 -07:00
git
2016-02-21 04:24:21 -08:00
2019-11-16 15:21:45 -08:00
# Get the latest pip (Ubuntu version doesn't support manylinux2010)
RUN \
curl https://bootstrap.pypa.io/get-pip.py | python3
2018-07-10 18:20:33 -07:00
# Compile and install jbig2
2018-07-11 00:56:55 -07:00
# Needs libleptonica-dev, zlib1g-dev
2018-07-10 21:56:49 -07:00
RUN \
mkdir jbig2 \
&& curl -L https://github.com/agl/jbig2enc/archive/ea6a40a.tar.gz | \
2019-05-28 15:36:50 -07:00
tar xz -C jbig2 --strip-components=1 \
2018-07-10 18:20:33 -07:00
&& cd jbig2 \
2018-07-10 21:56:49 -07:00
&& ./autogen.sh && ./configure && make && make install \
2018-07-10 18:20:33 -07:00
&& cd .. \
&& rm -rf jbig2
2019-05-28 15:36:50 -07:00
COPY . /app
WORKDIR /app
2016-02-21 04:24:21 -08:00
2021-06-09 00:47:39 -07:00
RUN pip3 install --no-cache-dir .[test,webservice,watcher]
2015-08-18 04:46:25 -07:00
2019-05-28 15:36:50 -07:00
FROM base
RUN apt-get update && apt-get install -y --no-install-recommends \
ghostscript \
img2pdf \
libsm6 libxext6 libxrender-dev \
2019-05-28 15:36:50 -07:00
pngquant \
tesseract-ocr \
tesseract-ocr-chi-sim \
tesseract-ocr-deu \
tesseract-ocr-eng \
tesseract-ocr-fra \
tesseract-ocr-por \
tesseract-ocr-spa \
2021-04-05 01:38:48 -07:00
unpaper \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
2019-11-03 23:52:08 -08:00
COPY --from=builder /usr/local/lib/ /usr/local/lib/
COPY --from=builder /usr/local/bin/ /usr/local/bin/
2019-05-28 15:36:50 -07:00
COPY --from=builder /app/misc/webservice.py /app/
COPY --from=builder /app/misc/watcher.py /app/
2019-05-28 15:36:50 -07:00
# Copy minimal project files to get the test suite.
COPY --from=builder /app/setup.cfg /app/setup.py /app/README.md /app/
COPY --from=builder /app/tests /app/tests
ENTRYPOINT ["/usr/local/bin/ocrmypdf"]