From c857d092b1b0526a0507cffb431e9dc387b3fc55 Mon Sep 17 00:00:00 2001 From: cesarblancg Date: Thu, 4 Feb 2021 10:07:43 +0100 Subject: [PATCH] Optimized dockerfile --- Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c6c4bc9..1605ccb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,25 @@ FROM python:3.8-alpine +#Install all dependencies. RUN apk add --no-cache postgresql-libs gettext zlib libjpeg libxml2-dev libxslt-dev + +#Print all logs without buffering it. ENV PYTHONUNBUFFERED 1 + +#This port will be used by gunicorn. EXPOSE 8080 +#Create app dir and install requirements. RUN mkdir /opt/recipes WORKDIR /opt/recipes -COPY . ./ -RUN chmod +x boot.sh +COPY requirements.txt ./ RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libressl-dev libffi-dev && \ python -m venv venv && \ venv/bin/pip install -r requirements.txt --no-cache-dir &&\ apk --purge del .build-deps +#Copy project and execute it. +COPY . ./ +RUN chmod +x boot.sh ENTRYPOINT ["/opt/recipes/boot.sh"] \ No newline at end of file