FROM python:latest # get args from build: in docker-compose # this forces /code to be owned by the user specified in the docker-compose file, we could ignore issues without this (but I am writing log files to the current dir with gunicorn as a non-priv'd user) ARG USERID ARG GROUPID RUN apt-get dist-upgrade -y WORKDIR /code COPY . . RUN pip3 install -r requirements.txt RUN chown -R ${USERID}:${GROUPID} /code EXPOSE 80 CMD gunicorn --bind=0.0.0.0:80 --workers=2 --threads=2 main:app --env ENV="production" --error-logfile /code/gunicorn.error.log --access-logfile /code/gunicorn.log --capture-output # comment out the gunicorn line & uncomment the sleep so you can run gunicorn by hand in case it does not start on init (via docker exec...) #CMD sleep 99999