From ab0a210763118abe4c146faf1721e9a0d91c0ad7 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 14 Feb 2017 11:32:05 -0800 Subject: [PATCH] Update dockerfile.tess4 yet again Installing Tess4 PPA over Tess3 proved too much pain, so sever the link between this and the jbarlow83/ocrmypdf image, starting each from scratch. Also the complete set of language packs proves too much - the build seems likely to fail when trying to install so many. --- Dockerfile.tess4 | 53 +++++++++++++++++++++++++++++++++++++++---- docs/installation.rst | 3 ++- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/Dockerfile.tess4 b/Dockerfile.tess4 index d9bddf3c..68280554 100644 --- a/Dockerfile.tess4 +++ b/Dockerfile.tess4 @@ -1,20 +1,63 @@ # OCRmyPDF # # VERSION 4.4.2 -FROM jbarlow83/ocrmypdf:latest +FROM ubuntu:16.10 MAINTAINER James R. Barlow -USER root +RUN apt-get update && apt-get install -y --no-install-recommends \ + software-properties-common python-software-properties \ + python3-wheel \ + python3-reportlab \ + python3-venv \ + ghostscript \ + qpdf \ + poppler-utils \ + unpaper \ + libffi-dev RUN add-apt-repository ppa:alex-p/tesseract-ocr RUN apt-get update \ - && apt-get upgrade -y tesseract-ocr \ - && apt-get install -y --no-install-recommends tesseract-ocr-all + && apt-get autoremove -y \ + && apt-get install -y --no-install-recommends \ + tesseract-ocr \ + tesseract-ocr-eng \ + tesseract-ocr-fra \ + tesseract-ocr-deu \ + tesseract-ocr-spa \ + tesseract-ocr-por \ + tesseract-ocr-ara \ + tesseract-ocr-rus \ + tesseract-ocr-chi-sim -RUN apt-get autoremove -y && apt-get clean -y +RUN python3 -m venv --system-site-packages /appenv + +# 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. +RUN . /appenv/bin/activate; \ + pip install --upgrade pip \ + && pip install ocrmypdf + +# 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 USER docker +WORKDIR /home/docker # Must use array form of ENTRYPOINT # Non-array form does not append other arguments, because that is "intuitive" diff --git a/docs/installation.rst b/docs/installation.rst index 5f232895..1f04db1f 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -46,7 +46,8 @@ Assuming you have a Docker engine running, you can download one of the three ava +-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+ | ocrmypdf-polyglot | ``docker pull jbarlow83/ocrmypdf-polyglot`` | As above, with all available language packs. | +-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+ -| ocrmypdf-tess4 | ``docker pull jbarlow83/ocrmypdf-tess4`` | Latest ocrmypdf with Tesseract 4.00.00alpha and all language packs. | +| ocrmypdf-tess4 | ``docker pull jbarlow83/ocrmypdf-tess4`` | Latest ocrmypdf with Tesseract 4.00.00alpha and English, French, German, | +| | | Spanish, Portuguese, Chinese Simplified, Arabic and Russian (the top 8). | +-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+ For example: