Skip to content

Commit 071a8ea

Browse files
Apply patches in backend container to address CVE findings by Defender (#246)
1 parent a0d987c commit 071a8ea

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docker/Dockerfile-backend

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
# For more information about the base image: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/python/about
55
FROM mcr.microsoft.com/devcontainers/python:3.10-bookworm
66

7+
# Patch Debian to remediate CVE findings
8+
# Apply Debian bookworm-updates by running a full system upgrade
9+
RUN echo "deb http://deb.debian.org/debian bookworm-updates main" >> /etc/apt/sources.list.d/bookworm-updates.list \
10+
&& echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list.d/backports.list \
11+
&& apt-get update \
12+
&& apt-get upgrade -y \
13+
&& apt-get autoremove -y \
14+
&& apt-get clean \
15+
&& rm -rf /var/lib/apt/lists/*
16+
717
# default graphrag version will be 0.0.0 unless overridden by --build-arg
818
ARG GRAPHRAG_VERSION=0.0.0
919
ENV GRAPHRAG_VERSION=v${GRAPHRAG_VERSION}
@@ -12,6 +22,9 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1
1222
ENV SETUPTOOLS_USE_DISTUTILS=stdlib
1323
ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken_cache/
1424

25+
# CVE finding in pip < 23.3 - Upgrade pip to version 23.3 or greater
26+
RUN pip install --upgrade pip
27+
1528
COPY backend /backend
1629
RUN cd backend \
1730
&& pip install poetry \
@@ -23,6 +36,9 @@ RUN python -c "import nltk;nltk.download(['punkt','averaged_perceptron_tagger','
2336
# download tiktoken model encodings
2437
RUN python -c "import tiktoken; tiktoken.encoding_for_model('gpt-3.5-turbo'); tiktoken.encoding_for_model('gpt-4'); tiktoken.encoding_for_model('gpt-4o');"
2538

39+
# CVE finding in cryptography <= 44.0.0 - cache version 44.0.1 of cryptography via pip
40+
RUN pip install cryptography==44.0.1
41+
2642
WORKDIR /backend
2743
EXPOSE 80
2844
CMD ["uvicorn", "graphrag_app.main:app", "--host", "0.0.0.0", "--port", "80"]

0 commit comments

Comments
 (0)