From ad48fc641578f1d55a1272c6975a018c65b77455 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 3 Nov 2019 22:35:15 -0800 Subject: [PATCH] Remove Alpine Docker image --- .docker/alpine.dockerfile | 91 --------------------------------------- docs/batch.rst | 2 +- docs/docker.rst | 22 ++++++---- docs/introduction.rst | 2 +- 4 files changed, 15 insertions(+), 102 deletions(-) delete mode 100644 .docker/alpine.dockerfile diff --git a/.docker/alpine.dockerfile b/.docker/alpine.dockerfile deleted file mode 100644 index b2879e27..00000000 --- a/.docker/alpine.dockerfile +++ /dev/null @@ -1,91 +0,0 @@ -FROM alpine:3.9 as base - -FROM base as builder - -ENV LANG=C.UTF-8 - -# Normally: -# echo '@testing http://nl.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories - -RUN \ - echo -e '@testing http://nl.alpinelinux.org/alpine/edge/testing\n@community http://nl.alpinelinux.org/alpine/edge/community'\ - >> /etc/apk/repositories \ - # Add runtime dependencies - && apk add --update \ - python3-dev \ - py3-setuptools \ - jbig2enc@community \ - ghostscript \ - qpdf@community \ - qpdf-dev@community \ - tesseract-ocr \ - unpaper \ - pngquant \ - libxml2-dev \ - libxslt-dev \ - zlib-dev \ - libffi-dev \ - leptonica-dev \ - binutils \ - && pip3 install --upgrade pip \ - # Install pybind11 for pikepdf - && pip3 install pybind11 \ - # Install flask for the webservice - && pip3 install flask \ - # Add build dependencies - && apk add --virtual build-dependencies \ - build-base \ - git - -COPY . /app - -WORKDIR /app - -RUN pip3 install . - -FROM base - -ENV LANG=C.UTF-8 - -# Normally: -# echo '@testing http://nl.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories - -RUN \ - echo -e '@testing http://nl.alpinelinux.org/alpine/edge/testing\n@community http://nl.alpinelinux.org/alpine/edge/community'\ - >> /etc/apk/repositories \ - # Add runtime dependencies - && apk add --update \ - python3 \ - jbig2enc@community \ - ghostscript \ - qpdf@community \ - qpdf-dev@community \ - tesseract-ocr \ - tesseract-ocr-data-deu \ - tesseract-ocr-data-chi_sim \ - unpaper \ - pngquant \ - libxml2 \ - libxslt \ - zlib \ - libffi \ - leptonica-dev \ - binutils \ - && mkdir /app - -WORKDIR /app - -# Copy build artifacts (python site-packages) -COPY --from=builder /usr/lib/python3.6/site-packages /usr/lib/python3.6/site-packages -COPY --from=builder /usr/bin/ocrmypdf /usr/bin/dumppdf.py /usr/bin/latin2ascii.py /usr/bin/pdf2txt.py /usr/bin/img2pdf /usr/bin/chardetect /usr/bin/ - -# Copy -COPY --from=builder /app/misc/webservice.py /app/ - -# 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/requirements /app/requirements -COPY --from=builder /app/tests /app/tests -COPY --from=builder /app/src /app/src - -ENTRYPOINT ["/usr/bin/ocrmypdf"] diff --git a/docs/batch.rst b/docs/batch.rst index 555879b2..d27836c1 100644 --- a/docs/batch.rst +++ b/docs/batch.rst @@ -47,7 +47,7 @@ where the PDFs are stored): .. code-block:: bash - find . -printf '%p' -name '*.pdf' -exec docker run --rm -v : jbarlow83/ocrmypdf-alpine '/{}' '/{}' \; + find . -printf '%p' -name '*.pdf' -exec docker run --rm -v : jbarlow83/ocrmypdf '/{}' '/{}' \; This only runs one ``ocrmypdf`` process at a time. This variation uses ``find`` to create a directory list and ``parallel`` to parallelize runs diff --git a/docs/docker.rst b/docs/docker.rst index 3b34ebba..4cd34d83 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -23,11 +23,11 @@ If you have `Docker `__ installed on your system, you can install a Docker image of the latest release. The recommended OCRmyPDF Docker image is currently named -``ocrmypdf-alpine``: +``ocrmypdf``: .. code-block:: bash - docker pull jbarlow83/ocrmypdf-alpine + docker pull jbarlow83/ocrmypdf Follow the Docker installation instructions for your platform. If you can run this command successfully, your system is ready to download and @@ -63,7 +63,7 @@ To start a Docker container (instance of the image): .. code-block:: bash - docker tag jbarlow83/ocrmypdf-alpine ocrmypdf + docker tag jbarlow83/ocrmypdf ocrmypdf docker run --rm -i ocrmypdf (... all other arguments here...) For convenience, create a shell alias to hide the Docker command. It is @@ -103,7 +103,7 @@ on the public one: .. code-block:: dockerfile - FROM jbarlow83/ocrmypdf-alpine + FROM jbarlow83/ocrmypdf # Add French RUN apk add tesseract-ocr-data-fra @@ -117,17 +117,16 @@ The OCRmyPDF test suite is installed with image. To run it: .. code-block:: bash - docker run --entrypoint python3 jbarlow83/ocrmypdf-alpine setup.py test + docker run --entrypoint python3 jbarlow83/ocrmypdf setup.py test Accessing the shell =================== -``bash`` is not installed in the image. To use the busybox shell in the -Docker image: +To use the bash shell in the Docker image: .. code-block:: bash - docker run -it --entrypoint busybox jbarlow83/ocrmypdf-alpine sh + docker run -it --entrypoint bash jbarlow83/ocrmypdf Using the OCRmyPDF web service wrapper ====================================== @@ -137,7 +136,12 @@ service. The webservice may be launched as follows: .. code-block:: bash - docker run --entrypoint python3 -p 5000:5000 jbarlow83/ocrmypdf-alpine webservice.py + docker run --entrypoint python3 -p 5000:5000 jbarlow83/ocrmypdf webservice.py + +This will configure the machine to listen on port 5000. On Linux machines +this is port 5000 of localhost. On macOS or Windows machines running +Docker, this is port 5000 of the virtual machine that runs your Docker +images. You can find its IP address using the command ``docker-machine ip``. Unlike command line usage this program will open a socket and wait for connections. diff --git a/docs/introduction.rst b/docs/introduction.rst index acc23aee..efe1de91 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -208,7 +208,7 @@ consider one of these similar open source programs: Web front-ends ============== -The Docker image ``ocrmypdf-alpine`` provides a web service front-end +The Docker image ``ocrmypdf`` provides a web service front-end that allows files to submitted over HTTP and the results "downloaded". This is an HTTP server intended to simplify web services deployments; it is not intended to be deployed on the public internet and no real