2015-08-18 04:46:25 -07:00
|
|
|
# OCRmyPDF
|
|
|
|
|
#
|
2017-10-08 12:13:20 -07:00
|
|
|
FROM ubuntu:17.04
|
2015-08-18 04:46:25 -07:00
|
|
|
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
2017-02-06 14:38:52 -08:00
|
|
|
software-properties-common python-software-properties \
|
|
|
|
|
python3-wheel \
|
2015-08-20 01:25:31 -07:00
|
|
|
python3-reportlab \
|
2017-02-06 14:38:52 -08:00
|
|
|
python3-venv \
|
|
|
|
|
ghostscript \
|
2016-02-05 01:38:59 -08:00
|
|
|
qpdf \
|
2016-02-21 04:24:21 -08:00
|
|
|
poppler-utils \
|
2017-02-06 14:38:52 -08:00
|
|
|
unpaper \
|
|
|
|
|
libffi-dev \
|
2016-02-05 01:38:59 -08:00
|
|
|
tesseract-ocr \
|
2017-02-06 14:38:52 -08:00
|
|
|
tesseract-ocr-eng \
|
|
|
|
|
tesseract-ocr-fra \
|
|
|
|
|
tesseract-ocr-spa \
|
|
|
|
|
tesseract-ocr-deu
|
2016-02-21 04:24:21 -08:00
|
|
|
|
2017-08-30 13:25:54 -07:00
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
|
|
2017-02-06 14:38:52 -08:00
|
|
|
RUN python3 -m venv --system-site-packages /appenv
|
2016-02-21 04:24:21 -08:00
|
|
|
|
2017-02-06 14:38:52 -08:00
|
|
|
# This installs the latest binary wheel instead of the code in the current
|
|
|
|
|
# folder. Installing from source will fail, apparently because cffi needs
|
|
|
|
|
# build-essentials (gcc) to do a source installation
|
|
|
|
|
# (i.e. "pip install ."). It's unclear to me why this is the case.
|
2015-08-18 05:38:05 -07:00
|
|
|
RUN . /appenv/bin/activate; \
|
2015-08-20 01:25:31 -07:00
|
|
|
pip install --upgrade pip \
|
2017-02-06 14:38:52 -08:00
|
|
|
&& pip install ocrmypdf
|
2015-08-18 04:46:25 -07:00
|
|
|
|
2017-02-06 14:38:52 -08:00
|
|
|
# Now copy the application in, mainly to get the test suite.
|
|
|
|
|
# Do this now to make the best use of Docker cache.
|
|
|
|
|
COPY . /application
|
|
|
|
|
RUN . /appenv/bin/activate; \
|
|
|
|
|
pip install -r /application/test_requirements.txt
|
|
|
|
|
|
|
|
|
|
# Remove the junk, including the source version of application since it was
|
|
|
|
|
# already installed
|
|
|
|
|
RUN rm -rf /tmp/* /var/tmp/* /root/* /application/ocrmypdf \
|
|
|
|
|
&& apt-get autoremove -y \
|
|
|
|
|
&& apt-get autoclean -y
|
|
|
|
|
|
|
|
|
|
RUN useradd docker \
|
|
|
|
|
&& mkdir /home/docker \
|
|
|
|
|
&& chown docker:docker /home/docker
|
2016-02-17 00:13:45 -08:00
|
|
|
|
2015-08-18 04:46:25 -07:00
|
|
|
USER docker
|
|
|
|
|
WORKDIR /home/docker
|
2015-08-18 23:30:06 -07:00
|
|
|
|
2015-08-18 23:41:41 -07:00
|
|
|
# Must use array form of ENTRYPOINT
|
|
|
|
|
# Non-array form does not append other arguments, because that is "intuitive"
|
2017-03-10 22:46:13 -08:00
|
|
|
ENTRYPOINT ["/application/docker-wrapper.sh"]
|