From 7068cb48e2ac95b78cdd8b2dbc3143f8462ef650 Mon Sep 17 00:00:00 2001 From: Georg Krause Date: Mon, 10 Jan 2022 15:48:38 +0100 Subject: [PATCH] Build docker image with poetry managed dependencies --- api/Dockerfile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 3bbedf12b..dfe92eff2 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -28,21 +28,24 @@ RUN python -m venv --system-site-packages /venv # emulate activation by prefixing PATH ENV PATH="/venv/bin:$PATH" VIRTUAL_ENV=/venv -RUN mkdir /requirements -COPY ./requirements/base.txt /requirements/base.txt +COPY pyproject.toml poetry.lock / # hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072 ENV PIP_DOWNLOAD_CACHE=/noop/ RUN \ echo 'installing pip requirements' && \ - pip3 install --upgrade pip && \ + pip3 install --upgrade pip poetry && \ pip3 install setuptools wheel && \ - pip3 install -r /requirements/base.txt cryptography==3.3.2 && \ + poetry export --without-hashes | grep -v cryptography | pip3 install -r /dev/stdin cryptography==3.3.2 && \ rm -rf $PIP_DOWNLOAD_CACHE ARG install_dev_deps=0 -COPY ./requirements/*.txt /requirements/ RUN \ - if [ "$install_dev_deps" = "1" ] ; then echo "Installing dev dependencies" && pip3 install --no-cache-dir -r /requirements/local.txt -r /requirements/test.txt ; else echo "Skipping dev deps installation" ; fi + if [ "$install_dev_deps" = "1" ] ; then \ + echo "Installing dev dependencies" && \ + poetry export --dev --without-hashes | grep -v cryptography | pip3 install -r /dev/stdin cryptography==3.3.2 && \ + ; else \ + echo "Skipping dev deps installation" \ + ; fi FROM alpine:3.13 as build-image