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
#
FROM ubuntu:19.04 as base
FROM ubuntu:19.10 as base
FROM base as builder
@ -10,16 +10,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential autoconf automake libtool \
libleptonica-dev \
zlib1g-dev \
ocrmypdf \
pngquant \
python3-setuptools \
python3-pip \
python3-venv \
tesseract-ocr \
unpaper \
wget \
git
# Compile and install jbig2
# Needs libleptonica-dev, zlib1g-dev
RUN \
@ -31,15 +26,15 @@ RUN \
&& cd .. \
&& rm -rf jbig2
RUN python3 -m venv /appenv
COPY . /app
WORKDIR /app
RUN . /appenv/bin/activate; \
pip install --upgrade pip \
&& pip install .
RUN pip3 install \
-r requirements/main.txt \
-r requirements/webservice.txt \
-r requirements/test.txt \
.
FROM base
@ -53,7 +48,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g \
pngquant \
python3 \
python3-venv \
qpdf \
tesseract-ocr \
tesseract-ocr-chi-sim \
@ -62,10 +56,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr-fra \
tesseract-ocr-por \
tesseract-ocr-spa \
unpaper \
wget
unpaper
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 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/src /app/src
COPY --from=builder /appenv /appenv
COPY --from=builder /usr/local /usr/local
ENTRYPOINT ["/appenv/bin/ocrmypdf"]
ENTRYPOINT ["/usr/local/bin/ocrmypdf"]

View File

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

View File

@ -1,13 +1,10 @@
# 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
# installation
chardet == 3.0.4
cffi == 1.12.2
cffi == 1.13.2
img2pdf == 0.3.3
pdfminer.six == 20181108
pikepdf == 1.6.5
Pillow >= 6.2.0
pycparser == 2.19
python-xmp-toolkit == 2.0.1
reportlab == 3.5.13
tqdm == 4.32.1
reportlab == 3.5.32
tqdm == 4.37.0

View File

@ -2,7 +2,7 @@ pytest >= 5.0.0
pytest-helpers-namespace >= 2019.1.8
pytest-xdist >= 1.29.0 # For DumpError fix
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
PyPDF2 >= 1.26.0
#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
pytestmark = pytest.mark.skipif(
pytest.helpers.running_in_docker(), # pylint: disable=no-member
reason="docker can't complete",
)
def test_fish():
try: