Dockerfile 1.68 KB
Newer Older
1
# First stage to build assets
2
ARG DISTRO=alpine:3.14.5
3
ARG ARCH=""
4

Diman0's avatar
Diman0 committed
5
FROM ${ARCH}node:16 as assets
6
7

COPY package.json ./
8
9
10
RUN set -eu \
 && npm config set update-notifier false \
 && npm install --no-fund
11

12
13
14
COPY webpack.config.js ./
COPY assets ./assets
RUN set -eu \
15
 && sed -i 's/#007bff/#55a5d9/' node_modules/admin-lte/build/scss/_bootstrap-variables.scss \
16
 && for l in ca da de:de_de en:en-gb es:es_es eu fr:fr_fr he hu is it:it_it ja nb_NO:no_nb nl:nl_nl pl pt:pt_pt ru sv:sv_se zh; do \
17
18
19
      cp node_modules/datatables.net-plugins/i18n/${l#*:}.json assets/${l%:*}.json; \
    done \
 && node_modules/.bin/webpack-cli --color
20
21
22


# Actual application
23
FROM $DISTRO
24
ARG VERSION
25
26
COPY --from=balenalib/rpi-alpine:3.14 /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static

DjVinnii's avatar
DjVinnii committed
27
28
ENV TZ Etc/UTC

29
30
LABEL version=$VERSION

31
# python3 shared with most images
32
RUN set -eu \
33
 && apk add --no-cache python3 py3-pip py3-wheel git bash tzdata \
34
 && pip3 install --upgrade pip
35

36
37
38
RUN mkdir -p /app
WORKDIR /app

39
COPY requirements-prod.txt requirements.txt
40
RUN set -eu \
41
42
 && apk add --no-cache libressl curl postgresql-libs mariadb-connector-c \
 && apk add --no-cache --virtual build-dep libressl-dev libffi-dev python3-dev build-base postgresql-dev mariadb-connector-c-dev cargo \
43
44
 && pip install --upgrade pip \
 && pip install -r requirements.txt \
45
 && apk del --no-cache build-dep
46

47
COPY --from=assets static ./mailu/static
48
49
COPY mailu ./mailu
COPY migrations ./migrations
Ionut Filip's avatar
Ionut Filip committed
50
COPY start.py /start.py
51
COPY audit.py /audit.py
52

53
RUN pybabel compile -d mailu/translations
54

55
EXPOSE 80/tcp
Tim Möhlmann's avatar
Tim Möhlmann committed
56
VOLUME ["/data","/dkim"]
57
ENV FLASK_APP mailu
58

59
CMD /start.py
60

Dimitri Huisman's avatar
Dimitri Huisman committed
61
HEALTHCHECK CMD curl -f -L http://localhost/sso/login?next=ui.index || exit 1
Florent Daigniere's avatar
Florent Daigniere committed
62
RUN echo $VERSION >> /version