fix: add optional graphrag toggle in dockerfile (#377)

* fix: toggle graphrag install in Docker build

* fix: update Dockerfile

* fix: remove unused logics in chat_fn

* fix: disable duckduckgo test due to API limit
This commit is contained in:
Tuan Anh Nguyen Dang (Tadashi_Cin)
2024-10-10 16:09:57 +07:00
committed by GitHub
parent 3ff6af8acf
commit 6da9db489f
5 changed files with 39 additions and 132 deletions

View File

@@ -14,10 +14,14 @@ RUN apt-get update -qqy && \
curl \
cargo
# Setup args
ARG ENABLE_GRAPHRAG=true
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8
ENV ENABLE_GRAPHRAG=${ENABLE_GRAPHRAG}
# Create working directory
WORKDIR /app
@@ -30,15 +34,19 @@ RUN bash scripts/download_pdfjs.sh $PDFJS_PREBUILT_DIR
# Copy contents
COPY . /app
COPY .env.example /app/.env
# Install pip packages
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/pip \
pip install -e "libs/kotaemon" \
&& pip install -e "libs/ktem" \
&& pip install graphrag future \
&& pip install "pdfservices-sdk@git+https://github.com/niallcm/pdfservices-python-sdk.git@bump-and-unfreeze-requirements"
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/pip \
if [ "$ENABLE_GRAPHRAG" = "true" ]; then pip install graphrag future; fi
# Clean up
RUN apt-get autoremove \
&& apt-get clean \
@@ -66,10 +74,6 @@ RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/pip \
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Copy contents
COPY . /app
COPY .env.example /app/.env
# Install additional pip packages
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/pip \