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 update && apt-get -y install cron sqlite3 sudo && apt-get dist-upgrade -y WORKDIR /code COPY requirements.txt . COPY crontab /etc/crontab RUN pip3 install --upgrade pip && pip3 install -r requirements.txt RUN groupadd -g ${GROUPID} finplan && useradd -m -u ${USERID} -g ${GROUPID} finplan COPY . . RUN chown -R finplan:finplan /code EXPOSE 80 # NOTE, wrapper.sh will use sudo to work in PROD and DEV AS the correct # BOOK_UID/BOOK_GID as pybook user and group CMD ["./wrapper.sh"]