FROM python:alpine WORKDIR /usr/src/app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt RUN apk add python3-dev build-base linux-headers pcre-dev RUN pip install uwsgi ENV UID=0 ENV MOUNT=/ COPY ./main.py ./list.tpl ./ # I juste wanted to change the socket owner but it turned out I needed to change thu uwsgi user #CMD uwsgi --exec-asap 'chown $UID:$UID /tmp/uwsgi/ ; mkdir -p $BASE_PATH && chown $UID:$UID $BASE_PATH' -s /tmp/uwsgi/uwsgi.sock --uid $UID --manage-script-name --mount /=server:app # --log-master makes 500 error on 30s timeout for every valid http request CMD uwsgi --chown-socket $UID -s /tmp/uwsgi/uwsgi.sock --manage-script-name --mount $MOUNT=main:prod_app --http-timeout 10 --master --hook-master-start "unix_signal:15 gracefully_kill_them_all" --need-app --die-on-term --show-config --log-master --strict --vacuum --single-interpreter #--logto /dev/stderr --logto2 /dev/stderr