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.
This commit is contained in:
Nicolas CARPi 2020-01-23 16:04:06 +01:00
parent c279033330
commit 55f54497f2
2 changed files with 9 additions and 10 deletions

View File

@ -5,4 +5,6 @@ db.sqlite
.pytest_cache
.vscode
.DS_Store
config
config
LICENSE
README.md

View File

@ -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"]