Dockerfile: remove venv from Ubuntu image; tweak reqs

This commit is contained in:
James R. Barlow 2019-11-03 23:39:40 -08:00
parent ad48fc6415
commit c3719d3b72
6 changed files with 25 additions and 28 deletions

View File

@ -1,6 +1,6 @@
# OCRmyPDF # OCRmyPDF
# #
FROM ubuntu:19.04 as base FROM ubuntu:19.10 as base
FROM base as builder FROM base as builder
@ -10,16 +10,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential autoconf automake libtool \ build-essential autoconf automake libtool \
libleptonica-dev \ libleptonica-dev \
zlib1g-dev \ zlib1g-dev \
ocrmypdf \ python3-setuptools \
pngquant \
python3-pip \ python3-pip \
python3-venv \
tesseract-ocr \
unpaper \
wget \ wget \
git git
# Compile and install jbig2 # Compile and install jbig2
# Needs libleptonica-dev, zlib1g-dev # Needs libleptonica-dev, zlib1g-dev
RUN \ RUN \
@ -31,15 +26,15 @@ RUN \
&& cd .. \ && cd .. \
&& rm -rf jbig2 && rm -rf jbig2
RUN python3 -m venv /appenv
COPY . /app COPY . /app
WORKDIR /app WORKDIR /app
RUN . /appenv/bin/activate; \ RUN pip3 install \
pip install --upgrade pip \ -r requirements/main.txt \
&& pip install . -r requirements/webservice.txt \
-r requirements/test.txt \
.
FROM base FROM base
@ -53,7 +48,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g \ zlib1g \
pngquant \ pngquant \
python3 \ python3 \
python3-venv \
qpdf \ qpdf \
tesseract-ocr \ tesseract-ocr \
tesseract-ocr-chi-sim \ tesseract-ocr-chi-sim \
@ -62,10 +56,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr-fra \ tesseract-ocr-fra \
tesseract-ocr-por \ tesseract-ocr-por \
tesseract-ocr-spa \ tesseract-ocr-spa \
unpaper \ unpaper
wget
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.7/dist-packages/ /usr/local/lib/python3.7/dist-packages/
COPY --from=builder /usr/local/bin/ocrmypdf /usr/local/bin/ocrmypdf
# Copy
COPY --from=builder /app/misc/webservice.py /app/ COPY --from=builder /app/misc/webservice.py /app/
# Copy minimal project files to get the test suite. # Copy minimal project files to get the test suite.
@ -74,7 +71,4 @@ COPY --from=builder /app/requirements /app/requirements
COPY --from=builder /app/tests /app/tests COPY --from=builder /app/tests /app/tests
COPY --from=builder /app/src /app/src COPY --from=builder /app/src /app/src
COPY --from=builder /appenv /appenv ENTRYPOINT ["/usr/local/bin/ocrmypdf"]
COPY --from=builder /usr/local /usr/local
ENTRYPOINT ["/appenv/bin/ocrmypdf"]

View File

@ -117,7 +117,7 @@ The OCRmyPDF test suite is installed with image. To run it:
.. code-block:: bash .. code-block:: bash
docker run --entrypoint python3 jbarlow83/ocrmypdf setup.py test docker run --entrypoint python3 jbarlow83/ocrmypdf -m pytest
Accessing the shell Accessing the shell
=================== ===================

View File

@ -1,13 +1,10 @@
# requirements.txt can be used to replicate the developer's build environment # requirements.txt can be used to replicate the developer's build environment
# setup.py lists a separate set of requirements that are looser to simplify # setup.py lists a separate set of requirements that are looser to simplify
# installation # installation
chardet == 3.0.4 cffi == 1.13.2
cffi == 1.12.2
img2pdf == 0.3.3 img2pdf == 0.3.3
pdfminer.six == 20181108 pdfminer.six == 20181108
pikepdf == 1.6.5 pikepdf == 1.6.5
Pillow >= 6.2.0 Pillow >= 6.2.0
pycparser == 2.19 reportlab == 3.5.32
python-xmp-toolkit == 2.0.1 tqdm == 4.37.0
reportlab == 3.5.13
tqdm == 4.32.1

View File

@ -2,7 +2,7 @@ pytest >= 5.0.0
pytest-helpers-namespace >= 2019.1.8 pytest-helpers-namespace >= 2019.1.8
pytest-xdist >= 1.29.0 # For DumpError fix pytest-xdist >= 1.29.0 # For DumpError fix
pytest-cov >= 2.6.1 pytest-cov >= 2.6.1
python-xmp-toolkit # requires apt-get install libexempi3 python-xmp-toolkit == 2.0.1 # requires apt-get install libexempi3
# or brew install exempi # or brew install exempi
PyPDF2 >= 1.26.0 PyPDF2 >= 1.26.0
#PyMuPDF == 1.13.4 # optional #PyMuPDF == 1.13.4 # optional

View File

@ -0,0 +1 @@
Flask >= 1, < 2

View File

@ -19,6 +19,11 @@ from subprocess import run, PIPE
import pytest import pytest
pytestmark = pytest.mark.skipif(
pytest.helpers.running_in_docker(), # pylint: disable=no-member
reason="docker can't complete",
)
def test_fish(): def test_fish():
try: try: