style: readability for docker pip dependencies install

This commit is contained in:
jo 2023-01-11 16:55:30 +01:00
parent 0b4319656a
commit 0e05587fed
No known key found for this signature in database
GPG Key ID: B2FEC9B22722B984
1 changed files with 25 additions and 21 deletions

View File

@ -48,29 +48,33 @@ ENV PATH="/venv/bin:/root/.local/bin:$PATH" VIRTUAL_ENV=/venv
COPY --from=pre-build /requirements.txt /requirements.txt COPY --from=pre-build /requirements.txt /requirements.txt
COPY --from=pre-build /dev-requirements.txt /dev-requirements.txt COPY --from=pre-build /dev-requirements.txt /dev-requirements.txt
# hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072
ARG PIP_DOWNLOAD_CACHE=/noop/ RUN set -eux; \
RUN \ pip3 install --upgrade pip; \
echo 'installing pip requirements' && \ pip3 install setuptools wheel; \
pip3 install --upgrade pip && \ # Currently we are unable to relieably build rust-based packages on armv7. This
pip3 install setuptools wheel && \ # is why we need to use the packages shipped by Alpine Linux.
# Currently we are unable to relieably build rust-based packages on armv7. This # Since poetry does not allow in-place dependency pinning, we need
# is why we need to use the packages shipped by Alpine Linux. # to install the deps using pip.
# Since poetry does not allow in-place dependency pinning, we need grep -Ev 'cryptography|lxml|pillow|psycopg2|watchfiles' /requirements.txt \
# to install the deps using pip. | pip3 install -r /dev/stdin \
grep -Ev 'cryptography|watchfiles|lxml|pillow|psycopg2' /requirements.txt | pip3 install -r /dev/stdin cryptography==38.0.3 watchfiles==0.18.1 lxml==4.9.2 pillow==9.3.0 psycopg2==2.9.5 && \ cryptography==38.0.3 \
rm -rf "$PIP_DOWNLOAD_CACHE" lxml==4.9.2 \
pillow==9.3.0 \
psycopg2==2.9.5 \
watchfiles==0.18.1
ARG install_dev_deps=0 ARG install_dev_deps=0
RUN \ RUN set -eux; \
if [ "$install_dev_deps" = "1" ] ; then \ if [ "$install_dev_deps" = "1" ] ; then \
echo "Installing dev dependencies" && \   grep -Ev 'cryptography|lxml|pillow|psycopg2|watchfiles' /dev-requirements.txt \
grep -Ev 'cryptography|watchfiles|lxml|pillow|psycopg2' /dev-requirements.txt | pip3 install -r /dev/stdin cryptography==38.0.3 watchfiles==0.18.1 lxml==4.9.2 pillow==9.3.0 psycopg2==2.9.5 && \   | pip3 install -r /dev/stdin \
rm -rf "$PIP_DOWNLOAD_CACHE" \   cryptography==38.0.3 \
; else \   lxml==4.9.2 \
echo "Skipping dev deps installation" \   pillow==9.3.0 \
; fi   psycopg2==2.9.5 \
  watchfiles==0.18.1; \
fi
FROM alpine:3.17 as image FROM alpine:3.17 as image