Files
ocrmypdf/Dockerfile
T

68 lines
1.9 KiB
Docker
Raw Normal View History

2015-08-18 04:46:25 -07:00
# OCRmyPDF
#
2016-02-05 16:08:26 -08:00
# VERSION 3.2
2015-08-20 01:25:31 -07:00
FROM debian:stretch
2015-08-18 04:46:25 -07:00
MAINTAINER James R. Barlow <jim@purplerock.ca>
# Add unprivileged user
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker
2015-08-20 01:25:31 -07:00
# Update system and install our dependencies
# If this command takes too Docker hub's automated build will timeout,
# so try it in portions
2015-08-18 04:46:25 -07:00
RUN apt-get update && apt-get install -y --no-install-recommends \
2015-08-20 01:44:30 -07:00
locales \
2015-08-18 04:46:25 -07:00
python3 \
python3-pip \
2015-08-20 01:25:31 -07:00
python3-venv \
python3-reportlab \
2016-01-04 15:07:12 -08:00
python3-pil \
python3-wheel
RUN apt-get install -y --no-install-recommends \
unpaper \
ghostscript \
qpdf \
poppler-utils
RUN apt-get install -y --no-install-recommends \
tesseract-ocr \
tesseract-ocr-deu tesseract-ocr-spa tesseract-ocr-eng tesseract-ocr-fra
2015-08-18 04:46:25 -07:00
2015-08-20 01:44:30 -07:00
# Enforce UTF-8
# Borrowed from https://index.docker.io/u/crosbymichael/python/
RUN dpkg-reconfigure locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8
ENV LC_ALL C.UTF-8
2016-01-04 15:07:12 -08:00
# Remove the junk
RUN apt-get autoremove -y && apt-get clean -y
2015-09-06 00:02:58 -07:00
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/*
2015-08-20 01:25:31 -07:00
# Set up a Python virtualenv and take all of the system packages, so we can
# rely on the platform packages rather than importing GCC and compiling them
RUN pyvenv /appenv \
&& pyvenv --system-site-packages /appenv
2015-08-18 05:38:05 -07:00
2016-02-06 23:13:16 -08:00
COPY ./docker-wrapper.sh /application/
COPY ./test_requirements.txt /application/
2015-08-20 01:25:31 -07:00
# Install application and dependencies
# In this arrangement Pillow and reportlab will be provided by the system
2015-08-18 05:38:05 -07:00
RUN . /appenv/bin/activate; \
2015-08-20 01:25:31 -07:00
pip install --upgrade pip \
&& pip install ocrmypdf \
2015-08-20 01:25:31 -07:00
&& pip install --no-cache-dir -r /application/test_requirements.txt
2015-08-18 04:46:25 -07:00
USER docker
WORKDIR /home/docker
2015-08-20 01:25:31 -07:00
ENV OCRMYPDF_TEST_OUTPUT=/tmp/test-output
2015-08-20 02:36:28 -07:00
ENV OCRMYPDF_IN_DOCKER=1
2015-08-18 04:46:25 -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"
2015-08-19 13:10:58 -07:00
ENTRYPOINT ["/application/docker-wrapper.sh"]