From e65d54ccbc3e0bab5d5493c3d2b4e0e6a85be015 Mon Sep 17 00:00:00 2001 From: Dakshraj Sharma Date: Thu, 8 Oct 2020 21:19:49 +0530 Subject: [PATCH] Dockerfile updates for better dev/build times - Rearranged Dockerfile commands to install dependencies only when dependencies change. - As it was earlier, the pip dependencies were reinstalled after every change in code (.py) files, which was completely unnecessary - Added Cmake as an OS dependency as builds were failing without it Closes #10 --- Dockerfile | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac7b7c5..2e3a3e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,27 +2,24 @@ FROM debian:buster-slim as buildstage LABEL maintainer="Utsav Mishra " -# Install dependencies and Google tesseract +# Install OS dependencies and Google tesseract RUN apt-get update && \ apt-get install -y git pkg-config && \ apt-get install -y libsm6 libxext6 libxrender-dev && \ + apt-get install -y cmake && \ apt-get install -y python-pip && \ apt-get install -y tesseract-ocr && \ apt-get install -y libtesseract-dev +# Create and set working directory for Python app +WORKDIR /aadhaar_ocr_masking -# Build Python APP Here -RUN mkdir aadhaar_ocr_masking - - -COPY Aadhaar.py /aadhaar_ocr_masking/Aadhaar.py -COPY app.py /aadhaar_ocr_masking/app.py -COPY requirements.txt /aadhaar_ocr_masking/requirements.txt - -RUN cd aadhaar_ocr_masking && \ - pip install -r requirements.txt +# Install pip dependencies +COPY requirements.txt requirements.txt +RUN python -m pip install -r requirements.txt -WORKDIR /aadhaar_ocr_masking +# Copy project files to workdir +COPY Aadhaar.py app.py ./ CMD ["python", "app.py"]