From 802472cd99c46c947370cbb4f731ee0990511f5e Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Mon, 10 Jul 2023 23:27:02 -0700 Subject: [PATCH 1/2] Reduce Khoj Docker image size by 2Gb by not caching pip packages Resolve #148 --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d1cb525..f160cb1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,8 @@ LABEL org.opencontainers.image.source https://github.com/khoj-ai/khoj RUN apt update -y && \ apt -y install python3-pip python3-pyqt6 git -# Install Python Dependencies -RUN pip install --upgrade pip && \ - pip install git+https://github.com/khoj-ai/khoj.git +# Install Application +RUN pip install --no-cache-dir git+https://github.com/khoj-ai/khoj.git # Run the Application # There are more arguments required for the application to run, From 6308388dfcb388c260bb553901f5136ee6aefa66 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 11 Jul 2023 00:41:05 -0700 Subject: [PATCH 2/2] Install Khoj on Docker from local app instead of pulling from github Just use a random static version for Khoj on the Docker as otherwise the hatch vcs dynamic versioning requires the .git directory in the docker image too --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f160cb1b..760d10b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,9 @@ RUN apt update -y && \ apt -y install python3-pip python3-pyqt6 git # Install Application -RUN pip install --no-cache-dir git+https://github.com/khoj-ai/khoj.git +COPY . . +RUN sed -i 's/dynamic = \["version"\]/version = "0.0.0"/' pyproject.toml && \ + pip install --no-cache-dir . # Run the Application # There are more arguments required for the application to run,