Disable pip cache for Dockerfiles (#2015)

This commit is contained in:
oryx1729 2022-01-19 10:26:17 +01:00 committed by GitHub
parent 6267476015
commit cb881b6fa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 14 deletions

View File

@ -4,7 +4,6 @@ on:
push:
branches:
- master
- docker-build
jobs:
build:

View File

@ -2,24 +2,28 @@ FROM python:3.7.4-stretch
WORKDIR /home/user
RUN apt-get update && apt-get install -y curl git pkg-config cmake
RUN apt-get update && apt-get install -y \
curl \
git \
pkg-config \
cmake \
libpoppler-cpp-dev \
tesseract-ocr \
libtesseract-dev \
poppler-utils && \
rm -rf /var/lib/apt/lists/*
# Install PDF converter
RUN wget --no-check-certificate https://dl.xpdfreader.com/xpdf-tools-linux-4.03.tar.gz && \
tar -xvf xpdf-tools-linux-4.03.tar.gz && cp xpdf-tools-linux-4.03/bin64/pdftotext /usr/local/bin
RUN apt-get install libpoppler-cpp-dev pkg-config -y --fix-missing
# Install Tesseract
RUN apt-get install tesseract-ocr libtesseract-dev poppler-utils -y
# copy code
COPY haystack /home/user/haystack
# install as a package
COPY setup.py requirements.txt README.md /home/user/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install -e .
RUN python3 -c "from haystack.utils.docker import cache_models;cache_models()"

View File

@ -1,4 +1,4 @@
FROM nvidia/cuda:11.1-runtime-ubuntu20.04
FROM nvidia/cuda:11.1-runtime-ubuntu20.04
WORKDIR /home/user
@ -11,7 +11,7 @@ RUN mkdir -p /home/user/file-upload && chmod 777 /home/user/file-upload
# Install software dependencies
RUN apt-get update && apt-get install -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && apt-get install -y \
apt-get install -y \
cmake \
curl \
git \
@ -25,7 +25,8 @@ RUN apt-get update && apt-get install -y software-properties-common && \
python3.7-distutils \
swig \
tesseract-ocr \
wget
wget && \
rm -rf /var/lib/apt/lists/*
# Install PDF converter
RUN curl -s https://dl.xpdfreader.com/xpdf-tools-linux-4.03.tar.gz | tar -xvzf - -C /usr/local/bin --strip-components=2 xpdf-tools-linux-4.03/bin64/pdftotext
@ -40,9 +41,9 @@ COPY setup.py requirements.txt README.md /home/user/
RUN pip install --upgrade pip
RUN echo "Install required packages" && \
# Install PyTorch for CUDA 11
pip3 install torch==1.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html && \
# Install from requirements.txt
pip3 install -r requirements.txt
pip3 install --no-cache-dir torch==1.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html && \
# Install from requirements.txt
pip3 install --no-cache-dir -r requirements.txt
# copy saved models
COPY README.md models* /home/user/models/