tall-truck-67859
12/15/2021, 10:51 AMeval $(minikube docker-env)
and try to pants package the dockerfile again, I have this :
ProcessExecutionFailure: Process 'Building docker image recital/n20-dev:latest.' failed with exit code 1.
stdout:
stderr:
2021/12/13 16:15:16 http2: server: error reading preface from client 192.168.49.2:2376: bogus greeting "Client sent an HTTP requ"
read tcp 192.168.49.1:38404->192.168.49.2:2376: read: connection reset by peer
I assume that I have to change docker context in pants.toml (DOCKER_HOST value in [docker]) but I still get the same error.
Docker built . -t {imagetag:version}
doesn’t work either.
Thanks for help 🙂curved-television-6568
12/15/2021, 11:00 AMdocker build …
directly from your terminal, that it doesn’t work?
In that case, getting that to work first, is probably a good first step.
What is the error output in that case?tall-truck-67859
12/15/2021, 11:02 AM> docker build --tag recital/n20-dev .
[+] Building 0.0s (2/2) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2B 0.0s
=> CANCELED [internal] load .dockerignore 0.0s
=> => transferring context: 0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount003739442/Dockerfile: no such file or directory
curved-television-6568
12/15/2021, 11:04 AMDockerfile
in you current directory.. do you use a Dockerfile, or instructions
on your docker_image
target?tall-truck-67859
12/15/2021, 11:10 AMFROM python:3.8
ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
WORKDIR /app
RUN apt-get update && apt-get clean \
&& apt-get install -y --no-install-recommends libopenjp2-7-dev \
libgdk-pixbuf2.0-dev \
cmake \
make \
wget \
g++ \
libjpeg-dev \
libopenjp2-7-dev \
libfreetype6-dev \
libfontconfig1-dev \
default-libmysqlclient-dev \
libtiff5-dev \
libomp-dev \
libopenblas-dev \
qpdf \
# OCR LIBS
tesseract-ocr libtesseract-dev libleptonica-dev pkg-config \
imagemagick tesseract-ocr-fra ghostscript
RUN apt update \
&& apt -y install -qq git cmake autotools-dev libopenjp2-7-dev libtiff5-dev libpng-dev libgif-dev libxt-dev autoconf automake libtool bzip2 libxml2-dev libuninameslist-dev libspiro-dev python-dev libpango1.0-dev libcairo-dev chrpath uuid-dev uthash-dev software-properties-common libpoppler-private-dev libpoppler-glib-dev wget
RUN wget <https://poppler.freedesktop.org/poppler-0.89.0.tar.xz> \
&& tar xvf poppler-0.89.0.tar.xz \
&& cd poppler-0.89.0 \
&& mkdir build \
&& cd build \
&& cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DTESTDATADIR=$PWD/testfiles \
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
.. \
&& make \
&& make install \
&& cd ../..
RUN apt update && apt install libreoffice unoconv -y
RUN python -m pip install nltk==3.6.2 && python -m nltk.downloader punkt && python -m nltk.downloader stopwords
COPY services/n20/resources /resources
COPY n20-*.whl .
RUN --mount=type=secret,id=pipconfig,dst=/etc/pip.conf \
python -m pip install --no-cache-dir n20-*.whl && \
rm n20-*.whl
RUN sed -i_bak 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/'i /etc/ImageMagick-6/policy.xml
RUN wget <https://github.com/DoubangoTelecom/tesseractMRZ/raw/master/tessdata_best/mrz.traineddata> -P /usr/share/tesseract-ocr/4.00/tessdata
RUN wget <https://github.com/tesseract-ocr/tessdata/raw/4.00/lat.traineddata> -P /usr/share/tesseract-ocr/4.00/tessdata
and in the build file (located at services/n20) :
docker_image(
name="n20",
dependencies=["src/python/n20:wheel", ":resources"],
image_tags=["{build_args.BITBUCKET_BUILD_NUMBER}"],
extra_build_args=["--secret id=pipconfig,src=pip.conf"],
repository="recital/n20-dev",
)
files(
name="resources",
sources=["resources/*"],
)
tall-truck-67859
12/15/2021, 11:11 AMcurved-television-6568
12/15/2021, 11:15 AMdocker build -t recital/n20-dev -f services/n20/Dockerfile .
and make sure to have your .dockerignore
properly skip files you don’t need, so you don’t get Gb of build context… 😉tall-truck-67859
12/15/2021, 11:38 AMcurved-television-6568
12/15/2021, 11:43 AM./pants package
🙂tall-truck-67859
12/15/2021, 11:47 AMcurved-television-6568
12/15/2021, 12:11 PMminikube docker-env
tells you, and put those env vars into your pants.toml
file under [docker].env_vars
(with just the names, as it will pick up the values from your env)tall-truck-67859
12/15/2021, 12:15 PMtall-truck-67859
12/15/2021, 12:36 PMcurved-television-6568
12/15/2021, 1:32 PM