From d3d47dce0bb7a15a5d7ce04b679950c4d64cc9b1 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 21 Dec 2023 17:07:08 +0530 Subject: [PATCH] Allow setting Khoj app version during docker build via build-args This will allow troubleshooting by getting the actual khoj version being used. Previously it was always set to a static 0.0.0 version Command to build Khoj docker image with dynamically set current app version: `docker-compose build server --build-arg VERSION=$(pipx run hatch version)' --- Dockerfile | 3 ++- prod.Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9882a236..e6a6fb4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,8 @@ WORKDIR /app # Install Application COPY pyproject.toml . COPY README.md . -RUN sed -i 's/dynamic = \["version"\]/version = "0.0.0"/' pyproject.toml && \ +ARG VERSION=0.0.0 +RUN sed -i "s/dynamic = \\[\"version\"\\]/version = \"$VERSION\"/" pyproject.toml && \ pip install --no-cache-dir . # Copy Source Code diff --git a/prod.Dockerfile b/prod.Dockerfile index 693a3a8b..8b21cb66 100644 --- a/prod.Dockerfile +++ b/prod.Dockerfile @@ -11,7 +11,8 @@ WORKDIR /app # Install Application COPY pyproject.toml . COPY README.md . -RUN sed -i 's/dynamic = \["version"\]/version = "0.0.0"/' pyproject.toml && \ +ARG VERSION=0.0.0 +RUN sed -i "s/dynamic = \\[\"version\"\\]/version = \"$VERSION\"/" pyproject.toml && \ TMPDIR=/home/cache/ pip install --cache-dir=/home/cache/ -e . # Copy Source Code