Fix and speed-up arm build. Allow chosing of prod/dev env.

main
Alexander Graf 2 years ago
parent 5c31120895
commit 7441a420c4
No known key found for this signature in database
GPG Key ID: B8A9DC143E075629

@ -22,28 +22,32 @@ CMD /bin/bash
# build virtual env (intermediate) # build virtual env (intermediate)
FROM system as build FROM system as build
ARG MAILU_ENV=prod
ENV VIRTUAL_ENV=/app/venv ENV VIRTUAL_ENV=/app/venv
COPY requirements-*.txt ./ COPY requirements-build.txt ./
RUN set -euxo pipefail \ RUN set -euxo pipefail \
; apk add --no-cache py3-pip \ ; apk add --no-cache py3-pip \
; python3 -m venv ${VIRTUAL_ENV} \ ; python3 -m venv ${VIRTUAL_ENV} \
; ${VIRTUAL_ENV}/bin/pip install --no-cache-dir -r requirements-build.txt ; ${VIRTUAL_ENV}/bin/pip install --no-cache-dir -r requirements-build.txt \
; apk del py3-pip
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
COPY requirements-${MAILU_ENV}.txt ./
COPY libs/ libs/ COPY libs/ libs/
RUN set -euxo pipefail \ RUN set -euxo pipefail \
; pip install --no-cache-dir -r requirements-prod.txt \ ; pip install -r requirements-${MAILU_ENV}.txt \
|| ( \ || ( \
apk add --no-cache --virtual .build-deps \ apk add --no-cache --virtual .build-deps \
build-base cargo gcc libffi-dev libressl-dev mariadb-connector-c-dev \ build-base gcc libffi-dev python3-dev \
musl-dev postgresql-dev python3-dev \ ; pip install -r requirements-${MAILU_ENV}.txt \
; pip install --no-cache-dir -r requirements-prod.txt \
; apk del .build-deps \ ; apk del .build-deps \
) ) \
; rm -rf /root/.cache /tmp/*.pem
# base mailu image # base mailu image

Loading…
Cancel
Save