|
|
|
@ -4,11 +4,14 @@
|
|
|
|
|
ARG DISTRO=alpine:3.14.5
|
|
|
|
|
FROM $DISTRO as system
|
|
|
|
|
|
|
|
|
|
ENV TZ Etc/UTC
|
|
|
|
|
ENV LANG C.UTF-8
|
|
|
|
|
ENV TZ=Etc/UTC LANG=C.UTF-8
|
|
|
|
|
|
|
|
|
|
ARG MAILU_UID=1000
|
|
|
|
|
ARG MAILU_GID=1000
|
|
|
|
|
|
|
|
|
|
RUN set -euxo pipefail \
|
|
|
|
|
; adduser -s /bin/bash -Dh /app -k /var/empty -u 1000 -g mailu app \
|
|
|
|
|
; addgroup -Sg ${MAILU_GID} mailu \
|
|
|
|
|
; adduser -Sg ${MAILU_UID} -G mailu -h /app -g "mailu app" -s /bin/bash mailu \
|
|
|
|
|
; apk add --no-cache bash ca-certificates python3 tzdata
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
@ -21,31 +24,26 @@ FROM system as build
|
|
|
|
|
|
|
|
|
|
ENV VIRTUAL_ENV=/app/venv
|
|
|
|
|
|
|
|
|
|
COPY requirements-*.txt ./
|
|
|
|
|
|
|
|
|
|
RUN set -euxo pipefail \
|
|
|
|
|
; apk add --no-cache py3-pip \
|
|
|
|
|
; python3 -m venv ${VIRTUAL_ENV} \
|
|
|
|
|
; venv/bin/pip install --no-cache-dir --upgrade --no-warn-script-location pip wheel
|
|
|
|
|
; ${VIRTUAL_ENV}/bin/pip install --no-cache-dir -r requirements-build.txt
|
|
|
|
|
|
|
|
|
|
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
|
|
|
|
|
|
|
|
|
COPY libs/ libs/
|
|
|
|
|
COPY --from=core ./ core/
|
|
|
|
|
COPY --from=optional ./ optional/
|
|
|
|
|
|
|
|
|
|
RUN set -euxo pipefail \
|
|
|
|
|
; grep -hEv '(podop|socrate)==' core/*/requirements.txt optional/*/requirements.txt \
|
|
|
|
|
| sort -u >libs/requirements.txt \
|
|
|
|
|
\
|
|
|
|
|
; venv/bin/pip install --no-cache-dir -r libs/requirements.txt \
|
|
|
|
|
; pip install --no-cache-dir -r requirements-prod.txt \
|
|
|
|
|
|| ( \
|
|
|
|
|
apk add --no-cache --virtual .build-deps \
|
|
|
|
|
build-base cargo gcc libffi-dev libressl-dev mariadb-connector-c-dev \
|
|
|
|
|
musl-dev postgresql-dev python3-dev \
|
|
|
|
|
; venv/bin/pip install --no-cache-dir -r libs/requirements.txt \
|
|
|
|
|
; apk del .build-deps \
|
|
|
|
|
) \
|
|
|
|
|
\
|
|
|
|
|
; venv/bin/pip freeze > venv/requirements.txt
|
|
|
|
|
build-base cargo gcc libffi-dev libressl-dev mariadb-connector-c-dev \
|
|
|
|
|
musl-dev postgresql-dev python3-dev \
|
|
|
|
|
; pip install --no-cache-dir -r requirements-prod.txt \
|
|
|
|
|
; apk del .build-deps \
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# base mailu image
|
|
|
|
|