FROM alpine:3.11.3@sha256:ddba4d27a7ffc3f86dd6c2f92041af252a1f23a8e742c90e6e1297bfa1bc0c45 EXPOSE 5000 WORKDIR /usr/src/app RUN apk add --no-cache \ uwsgi-python3 \ python3 \ libpq git # psycopg2 needs some extra build tools and headers. Install them and build in a # single step in order not to pollute Docker layers RUN apk add --no-cache --virtual .build-deps gcc python3-dev musl-dev postgresql-dev libffi-dev && \ pip3 install --no-cache-dir psycopg2==2.8.4 pycparser==2.20 cffi==1.14.0 bcrypt==3.1.7 pycryptodome==3.9.7 && \ apk del --no-cache .build-deps RUN apk add --no-cache py3-pillow cairo pango glib font-noto gdk-pixbuf-dev COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt ENV FLASK_APP formity ENV FLASK_ENV production COPY . . ENV prometheus_multiproc_dir /tmp STOPSIGNAL SIGINT USER uwsgi CMD flask db upgrade && exec uwsgi --http-socket 0.0.0.0:5000 \ --processes 4 \ --plugins python3 \ --wsgi formity.wsgi:application \ --touch-reload formity/wsgi.py