From 4166c560a7f5035cef725b5c238033eb562b42b3 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 12 Nov 2024 01:13:29 +0100 Subject: [PATCH 1/2] Add docker build var to spoof API version --- .docker/server_dockerfile | 6 ++++++ docker-compose.yml | 1 + 2 files changed, 7 insertions(+) diff --git a/.docker/server_dockerfile b/.docker/server_dockerfile index ee400a5cd..df968ab63 100644 --- a/.docker/server_dockerfile +++ b/.docker/server_dockerfile @@ -29,6 +29,12 @@ WORKDIR /app # Install the local version of the package and mount the repository data to get version info COPY ./pydatalab/ ./ RUN git config --global --add safe.directory / + +# Used to fake the version of the package in cases where datalab is only +# available as a git submodule or worktree +ARG SETUPTOOLS_SCM_PRETEND_VERSION +ENV SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION} + # Install editable mode so that the server runs from a sensible place where we can stuff .env files RUN --mount=type=bind,target=/.git,source=./.git uv pip install --python /opt/.venv/bin/python --no-deps --editable . diff --git a/docker-compose.yml b/docker-compose.yml index 31202ef1d..6b3608d3d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,7 @@ services: dockerfile: .docker/server_dockerfile args: - WEB_CONCURRENCY=4 + - SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION} depends_on: - database restart: unless-stopped From 73d19ad01b5ccce145f4b107612497bc4cbea4e4 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 12 Nov 2024 14:22:37 +0100 Subject: [PATCH 2/2] Move arg to above first uv build --- .docker/server_dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.docker/server_dockerfile b/.docker/server_dockerfile index df968ab63..82c6a7999 100644 --- a/.docker/server_dockerfile +++ b/.docker/server_dockerfile @@ -19,6 +19,11 @@ ENV UV_LINK_MODE=copy \ UV_PROJECT_ENVIRONMENT=/opt/.venv \ UV_PYTHON=python3.10 +# Used to fake the version of the package in cases where datalab is only +# available as a git submodule or worktree +ARG SETUPTOOLS_SCM_PRETEND_VERSION +ENV SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION} + WORKDIR /app COPY ./pydatalab/pyproject.toml . COPY ./pydatalab/uv.lock . @@ -30,11 +35,6 @@ WORKDIR /app COPY ./pydatalab/ ./ RUN git config --global --add safe.directory / -# Used to fake the version of the package in cases where datalab is only -# available as a git submodule or worktree -ARG SETUPTOOLS_SCM_PRETEND_VERSION -ENV SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION} - # Install editable mode so that the server runs from a sensible place where we can stuff .env files RUN --mount=type=bind,target=/.git,source=./.git uv pip install --python /opt/.venv/bin/python --no-deps --editable .