summaryrefslogtreecommitdiff
path: root/Dockerfile.production
blob: 35eb553e02fd43904bc013579678e832a99f3f18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# https://github.com/nginxinc/docker-nginx-unprivileged/blob/master/stable/buster/Dockerfile

From debian:buster-slim

LABEL maintainer="Mat-Web Co-Maintainer <jan.friedli@immerda.ch>"

WORKDIR /var/www/mat2-web

COPY . /var/www/mat2-web

ENV MAT2_WEB_DOWNLOAD_FOLDER /app/upload

RUN set -x \
    && addgroup --system --gid 101 nginx \
    && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx \
    && apt-get update \
    && apt-get install --no-install-recommends --no-install-suggests -y \
        ca-certificates \
        nginx \
        systemd \
        mat2 \
        uwsgi \
        uwsgi-plugin-python3 \
        python3-pip \
        python3-setuptools \
        python3-wheel \
    && pip3 install -r requirements.txt \
    && rm /etc/nginx/sites-enabled/default /etc/nginx/nginx.conf \
    && cp ./config/nginx-default.conf /etc/nginx/sites-enabled/default \
    && cp ./config/nginx.conf /etc/nginx/nginx.conf \
    && cp ./config/uwsgi.config /etc/uwsgi/apps-enabled/mat2-web.ini \
    && chown 101:101 /etc/uwsgi/apps-enabled/mat2-web.ini \
    && mkdir -p /var/cache/nginx \
    && chown -R 101:0 /var/cache/nginx \
    && chmod -R g+w /var/cache/nginx \
    && ln -sf /dev/stdout /var/log/nginx/access.log \
    && ln -sf /dev/stderr /var/log/nginx/error.log \
    && rm -rf /var/cache/apt/* /var/lib/apt/lists/* \
    && chown -R nginx:nginx .

STOPSIGNAL SIGTERM

USER 101

CMD ["sh", "-c", "nginx; uwsgi --ini /etc/uwsgi/apps-enabled/mat2-web.ini;"]