From 5dd10c961c629d5596b1b8c4d3f9e6df029ced4c Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Wed, 5 Jun 2019 03:14:36 -0700 Subject: [PATCH] Docker: prefer streaming --- .docker/Dockerfile | 2 -- .docker/alpine.dockerfile | 2 -- docs/docker.rst | 13 ++++++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 62fac8d3..c6bd51a6 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -76,6 +76,4 @@ COPY --from=builder /app/src /app/src COPY --from=builder /appenv /appenv COPY --from=builder /usr/local /usr/local -WORKDIR /data - ENTRYPOINT ["/appenv/bin/ocrmypdf"] diff --git a/.docker/alpine.dockerfile b/.docker/alpine.dockerfile index e6e743b5..d8472c11 100644 --- a/.docker/alpine.dockerfile +++ b/.docker/alpine.dockerfile @@ -88,6 +88,4 @@ COPY --from=builder /app/requirements /app/requirements COPY --from=builder /app/tests /app/tests COPY --from=builder /app/src /app/src -WORKDIR /data - ENTRYPOINT ["/usr/bin/ocrmypdf"] diff --git a/docs/docker.rst b/docs/docker.rst index df45ef23..b8f3657b 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -46,14 +46,15 @@ To start a Docker container (instance of the image): .. code-block:: bash docker tag jbarlow83/ocrmypdf-alpine ocrmypdf - docker run --rm ocrmypdf (... all other arguments here...) + docker run --rm -i ocrmypdf (... all other arguments here...) -For convenience, create a shell alias to hide the Docker command: +For convenience, create a shell alias to hide the Docker command. It is easier to send the input file to file stdin and read the output from stdout – this avoids the occasionally messy permission issues with Docker entirely. .. code-block:: bash - alias ocrmypdf='docker run --rm -v "$(pwd):/home/docker" ocrmypdf' + alias ocrmypdf='docker run --rm -i ocrmypdf' ocrmypdf --version # runs docker version + ocrmypdf output.pdf Or in the wonderful `fish shell `_: @@ -62,6 +63,12 @@ Or in the wonderful `fish shell `_: alias ocrmypdf 'docker run --rm ocrmypdf' funcsave ocrmypdf +Alternately, you could mount the local current working directory as a Docker volume: + +.. code-block:: bash + + docker run --rm -v $(pwd):/data ocrmypdf /data/input.pdf /data/output.pdf + .. _docker-lang-packs: Adding languages to the Docker image