contact-mailer/server/Dockerfile

23 lines
1.1 KiB
Docker
Executable File

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 spamassassin
RUN pip install uwsgi
#spamassassin_client
ENV UID=0
ENV MOUNT=/
# Since the package maintainer doesnt merge PR
# https://github.com/petermat/spamassassin_client/pull/2
COPY ./main.py ./spamassassin/spamassasin_client.py ./
# 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