fix(api/Dockerfile): remove autobahn dependency pin after upgrading cryptography

This commit is contained in:
JuniorJPDJ 2022-11-09 18:58:58 +00:00
parent 2cea142e30
commit c4367466bc
2 changed files with 9 additions and 6 deletions

View File

@ -9,6 +9,7 @@ COPY pyproject.toml poetry.lock /
RUN poetry export --without-hashes > requirements.txt RUN poetry export --without-hashes > requirements.txt
RUN poetry export --dev --without-hashes > dev-requirements.txt RUN poetry export --dev --without-hashes > dev-requirements.txt
FROM alpine:3.16 as builder FROM alpine:3.16 as builder
RUN \ RUN \
@ -43,7 +44,7 @@ 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 # hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072
ENV PIP_DOWNLOAD_CACHE=/noop/ ARG PIP_DOWNLOAD_CACHE=/noop/
RUN \ RUN \
echo 'installing pip requirements' && \ echo 'installing pip requirements' && \
pip3 install --upgrade pip && \ pip3 install --upgrade pip && \
@ -52,20 +53,21 @@ RUN \
# is why we need to use the packages shipped by Alpine Linux. # is why we need to use the packages shipped by Alpine Linux.
# Since poetry does not allow in-place dependency pinning, we need # Since poetry does not allow in-place dependency pinning, we need
# to install the deps using pip. # to install the deps using pip.
cat /requirements.txt | grep -Ev 'cryptography|autobahn|uvicorn|watchgod|watchfiles' | pip3 install -r /dev/stdin cryptography==3.4.8 autobahn==21.2.1 uvicorn==0.17.6 watchgod==0.8.2 && \ grep -Ev 'cryptography|uvicorn|watchgod|watchfiles' /requirements.txt | pip3 install -r /dev/stdin cryptography==3.4.8 uvicorn==0.17.6 watchgod==0.8.2 && \
rm -rf $PIP_DOWNLOAD_CACHE rm -rf "$PIP_DOWNLOAD_CACHE"
ARG install_dev_deps=0 ARG install_dev_deps=0
RUN \ RUN \
if [ "$install_dev_deps" = "1" ] ; then \ if [ "$install_dev_deps" = "1" ] ; then \
echo "Installing dev dependencies" && \ echo "Installing dev dependencies" && \
cat /dev-requirements.txt | grep -Ev 'cryptography|autobahn|uvicorn|watchgod|watchfiles' | pip3 install -r /dev/stdin cryptography==3.3.2 autobahn==21.2.1 uvicorn==0.17.6 watchgod==0.8.2 \ grep -Ev 'cryptography|uvicorn|watchgod|watchfiles' /dev-requirements.txt | pip3 install -r /dev/stdin cryptography==3.4.8 uvicorn==0.17.6 watchgod==0.8.2 && \
; else \ rm -rf "$PIP_DOWNLOAD_CACHE" \
; else \
echo "Skipping dev deps installation" \ echo "Skipping dev deps installation" \
; fi ; fi
FROM alpine:3.16 as build-image FROM alpine:3.16 as image
COPY --from=builder /venv /venv COPY --from=builder /venv /venv
# emulate activation by prefixing PATH # emulate activation by prefixing PATH

View File

@ -0,0 +1 @@
Fix docker API image building with removing autobahn workaround version pin