@ -22,7 +22,7 @@ CMD /bin/bash
# build virtual env (intermediate)
# build virtual env (intermediate)
FROM system as build
FROM system as build
ARG MAILU_ ENV = prod
ARG MAILU_ DEPS = prod
ENV VIRTUAL_ENV = /app/venv
ENV VIRTUAL_ENV = /app/venv
@ -37,18 +37,25 @@ RUN set -euxo pipefail \
ENV PATH = " ${ VIRTUAL_ENV } /bin: ${ PATH } "
ENV PATH = " ${ VIRTUAL_ENV } /bin: ${ PATH } "
COPY requirements-${ MAILU_ ENV } .txt ./
COPY requirements-${ MAILU_ DEPS } .txt ./
COPY libs/ libs/
COPY libs/ libs/
RUN set -euxo pipefail \
RUN set -euxo pipefail \
; machine = " $( uname -m) " ; deps = "" \
; pip install -r requirements-${ MAILU_DEPS } .txt || \
; [ [ " ${ 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 " \
machine = " $( uname -m) " \
; [ [ " ${ deps } " ] ] && apk add --virtual .build-deps ${ deps } \
; deps = "build-base gcc libffi-dev python3-dev" \
; [ [ " ${ 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 \
; [ [ " ${ machine } " = = armv7 ] ] && \
; pip install -r requirements-${ MAILU_ENV } .txt \
deps = " ${ deps } cargo git libressl-dev mariadb-connector-c-dev postgresql-dev " \
; apk -e info -q .build-deps && apk del -r .build-deps \
; apk add --virtual .build-deps ${ deps } \
; rm -rf /root/.cargo /root/.cache /tmp/*.pem
; [ [ " ${ 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
# base mailu image