diff --git a/Dockerfile b/Dockerfile index fb640acb..dcc98f56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,26 @@ -#Grab the latest alpine image -FROM alpine:latest - -# Install python and pip -RUN apk add --no-cache --update python3 py3-pip bash -ADD ./webapp/requirements.txt /tmp/requirements.txt - -# Install dependencies -RUN pip3 install --no-cache-dir -q -r /tmp/requirements.txt - -# Add our code -ADD ./webapp /opt/webapp/ -WORKDIR /opt/webapp - -# Expose is NOT supported by Heroku -# EXPOSE 5000 - -# Run the image as a non-root user -RUN adduser -D myuser -USER myuser - -# Run the app. CMD is required to run on Heroku -# $PORT is set by Heroku -CMD gunicorn --bind 0.0.0.0:$PORT wsgi - +#Grab the latest alpine image +FROM python:3.9-alpine + +# Install python and pip +RUN apk add --no-cache --update python3 py3-pip bash +ADD ./webapp/requirements.txt /tmp/requirements.txt + +# Install dependencies dans un environnement virtuel +RUN python3 -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" +RUN pip3 install --upgrade pip && pip3 install --no-cache-dir -r /tmp/requirements.txt + +# Add our code +ADD ./webapp /opt/webapp/ +WORKDIR /opt/webapp + +# Expose is NOT supported by Heroku +# EXPOSE 5000 + +# Run the image as a non-root user +RUN adduser -D myuser +USER myuser + +# Run the app. CMD is required to run on Heroku +# $PORT is set by Heroku +CMD ["gunicorn", "--bind", "0.0.0.0:$PORT", "wsgi"] \ No newline at end of file