From a2d43be6def679d5f9afbb90217bfd8248e201e4 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Tue, 1 Nov 2022 11:02:21 +0100 Subject: [PATCH] Fix building wheels when deps need to compile --- core/base/Dockerfile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/core/base/Dockerfile b/core/base/Dockerfile index 6f6cb7a2..a661877b 100644 --- a/core/base/Dockerfile +++ b/core/base/Dockerfile @@ -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