2024-06-26 15:45:06 -04:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
2025-01-30 13:59:51 -05:00
|
|
|
# For more information about the base image: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/python/about
|
2024-12-30 01:59:08 -05:00
|
|
|
FROM mcr.microsoft.com/devcontainers/python:3.10-bookworm
|
2024-06-26 15:45:06 -04:00
|
|
|
|
2025-02-14 14:21:10 -05:00
|
|
|
# Patch Debian to remediate CVE findings
|
|
|
|
# Apply Debian bookworm-updates by running a full system upgrade
|
|
|
|
RUN echo "deb http://deb.debian.org/debian bookworm-updates main" >> /etc/apt/sources.list.d/bookworm-updates.list \
|
|
|
|
&& echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list.d/backports.list \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get upgrade -y \
|
|
|
|
&& apt-get autoremove -y \
|
|
|
|
&& apt-get clean \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2024-06-26 15:45:06 -04:00
|
|
|
# default graphrag version will be 0.0.0 unless overridden by --build-arg
|
|
|
|
ARG GRAPHRAG_VERSION=0.0.0
|
|
|
|
ENV GRAPHRAG_VERSION=v${GRAPHRAG_VERSION}
|
|
|
|
ENV PIP_ROOT_USER_ACTION=ignore
|
|
|
|
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
ENV SETUPTOOLS_USE_DISTUTILS=stdlib
|
2024-12-30 00:59:35 -05:00
|
|
|
ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken_cache/
|
2024-06-26 15:45:06 -04:00
|
|
|
|
2025-02-14 14:21:10 -05:00
|
|
|
# CVE finding in pip < 23.3 - Upgrade pip to version 23.3 or greater
|
|
|
|
RUN pip install --upgrade pip
|
|
|
|
|
2024-06-26 15:45:06 -04:00
|
|
|
COPY backend /backend
|
2024-09-19 01:09:26 -04:00
|
|
|
RUN cd backend \
|
|
|
|
&& pip install poetry \
|
2024-06-26 15:45:06 -04:00
|
|
|
&& poetry config virtualenvs.create false \
|
2024-09-19 01:09:26 -04:00
|
|
|
&& poetry install
|
2024-06-26 15:45:06 -04:00
|
|
|
|
|
|
|
# download all nltk data that graphrag requires
|
2024-12-14 00:59:41 -05:00
|
|
|
RUN python -c "import nltk;nltk.download(['punkt','averaged_perceptron_tagger','maxent_ne_chunker','words','wordnet'])"
|
2024-12-30 00:59:35 -05:00
|
|
|
# download tiktoken model encodings
|
|
|
|
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');"
|
|
|
|
|
2025-02-14 14:21:10 -05:00
|
|
|
# CVE finding in cryptography <= 44.0.0 - cache version 44.0.1 of cryptography via pip
|
|
|
|
RUN pip install cryptography==44.0.1
|
|
|
|
|
2024-06-26 15:45:06 -04:00
|
|
|
WORKDIR /backend
|
|
|
|
EXPOSE 80
|
2025-01-30 13:59:51 -05:00
|
|
|
CMD ["uvicorn", "graphrag_app.main:app", "--host", "0.0.0.0", "--port", "80"]
|