From 55f54497f2b6405a8f406f493b0f65afcf4b7a8f Mon Sep 17 00:00:00 2001 From: Nicolas CARPi Date: Thu, 23 Jan 2020 16:04:06 +0100 Subject: [PATCH] Improve the Dockerfile * reduce number of layers * remove vim installation * add LICENSE and README to .dockerignore * don't cache with pip * add EXPOSE directive This set of changes reduces the image size by almost 100 Mb. --- .dockerignore | 4 +++- Dockerfile | 15 ++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.dockerignore b/.dockerignore index 44a7394c..16cdfb82 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,4 +5,6 @@ db.sqlite .pytest_cache .vscode .DS_Store -config \ No newline at end of file +config +LICENSE +README.md diff --git a/Dockerfile b/Dockerfile index 464787a6..e7096929 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,14 @@ FROM python:3.7 -RUN apt-get update - -RUN apt-get install -y vim - WORKDIR /code -COPY ./requirements.txt ./ -RUN pip3 install -r requirements.txt - - +# copy everything into /code COPY . . +# install dependencies +RUN pip3 install --no-cache-dir -r requirements.txt + +EXPOSE 7777 + #gunicorn wsgi:app -b 0.0.0.0:7777 -w 2 --timeout 15 --log-level DEBUG CMD ["gunicorn","wsgi:app","-b","0.0.0.0:7777","-w","2","--timeout","15"] -