|
|
|
@ -22,7 +22,7 @@ CMD /bin/bash
|
|
|
|
|
# build virtual env (intermediate)
|
|
|
|
|
FROM system as build
|
|
|
|
|
|
|
|
|
|
ARG MAILU_ENV=prod
|
|
|
|
|
ARG MAILU_DEPS=prod
|
|
|
|
|
|
|
|
|
|
ENV VIRTUAL_ENV=/app/venv
|
|
|
|
|
|
|
|
|
@ -37,18 +37,25 @@ RUN set -euxo pipefail \
|
|
|
|
|
|
|
|
|
|
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
|
|
|
|
|
|
|
|
|
COPY requirements-${MAILU_ENV}.txt ./
|
|
|
|
|
COPY requirements-${MAILU_DEPS}.txt ./
|
|
|
|
|
COPY libs/ libs/
|
|
|
|
|
|
|
|
|
|
RUN set -euxo pipefail \
|
|
|
|
|
; machine="$(uname -m)"; deps="" \
|
|
|
|
|
; [[ "${machine}" == arm* || "${machine}" == aarch64 ]] && deps="${deps} build-base gcc libffi-dev python3-dev" \
|
|
|
|
|
; [[ "${machine}" == armv7* ]] && deps="${deps} cargo git libressl-dev mariadb-connector-c-dev postgresql-dev" \
|
|
|
|
|
; [[ "${deps}" ]] && apk add --virtual .build-deps ${deps} \
|
|
|
|
|
; [[ "${machine}" == armv7* ]] && mkdir -p /root/.cargo/registry/index && git clone --bare https://github.com/rust-lang/crates.io-index.git /root/.cargo/registry/index/github.com-1285ae84e5963aae \
|
|
|
|
|
; pip install -r requirements-${MAILU_ENV}.txt \
|
|
|
|
|
; apk -e info -q .build-deps && apk del -r .build-deps \
|
|
|
|
|
; rm -rf /root/.cargo /root/.cache /tmp/*.pem
|
|
|
|
|
; pip install -r requirements-${MAILU_DEPS}.txt || \
|
|
|
|
|
{ \
|
|
|
|
|
machine="$(uname -m)" \
|
|
|
|
|
; deps="build-base gcc libffi-dev python3-dev" \
|
|
|
|
|
; [[ "${machine}" == armv7 ]] && \
|
|
|
|
|
deps="${deps} cargo git libressl-dev mariadb-connector-c-dev postgresql-dev" \
|
|
|
|
|
; apk add --virtual .build-deps ${deps} \
|
|
|
|
|
; [[ "${machine}" == armv7 ]] && \
|
|
|
|
|
mkdir -p /root/.cargo/registry/index && \
|
|
|
|
|
git clone --bare https://github.com/rust-lang/crates.io-index.git /root/.cargo/registry/index/github.com-1285ae84e5963aae \
|
|
|
|
|
; pip install -r requirements-${MAILU_DEPS}.txt \
|
|
|
|
|
; apk del -r .build-deps \
|
|
|
|
|
; rm -rf /root/.cargo /tmp/*.pem \
|
|
|
|
|
; } \
|
|
|
|
|
; rm -rf /root/.cache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# base mailu image
|
|
|
|
|