Skip to content

Commit e4dde57

Browse files
committed
refactor: Centralize SETUPTOOLS_SCM_PRETEND_VERSION and remove HATCH_VCS_PRETEND_VERSION from Dockerfile build commands.
1 parent f36f0de commit e4dde57

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

docker/Dockerfile.sql_to_arc

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ RUN pip install --no-cache-dir --upgrade pip==25.3 uv==0.9.27
1212

1313
# Declare build argument for versioning
1414
ARG APP_VERSION=0.0.0
15+
ENV SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION}
1516

1617
# We prefer to build a wheel for our package first. This ensures we have a clean,
1718
# distributable artifact that contains only the necessary files.
18-
# We set HATCH_VCS_PRETEND_VERSION so hatch-vcs can work without .git folder.
19-
# We also set SETUPTOOLS_SCM_PRETEND_VERSION for compatibility with related tools.
20-
RUN HATCH_VCS_PRETEND_VERSION=${APP_VERSION#v} \
21-
SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
22-
uv build --package sql_to_arc --wheel
19+
RUN uv build --package sql_to_arc --wheel
2320

2421

2522
# ---- Binary Build Stage ----
@@ -39,8 +36,7 @@ WORKDIR /build
3936
# Install uv core tool
4037
RUN pip install --no-cache-dir --upgrade pip==25.3 uv==0.9.27
4138

42-
# Declare build argument for versioning
43-
ARG APP_VERSION=0.0.0
39+
4440

4541
# Bring in the pre-built wheel and project metadata
4642
COPY --from=package-builder /build/dist/*.whl /tmp/wheels/
@@ -56,16 +52,12 @@ COPY middleware ./middleware
5652
# as pre-built wheels on PyPI.
5753
# 3. Thus, we use 'uv sync' to create a virtual environment (.venv) and resolve all
5854
# complex dependencies exactly as specified in the uv.lock.
59-
RUN HATCH_VCS_PRETEND_VERSION=${APP_VERSION#v} \
60-
SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
61-
uv sync --no-dev
55+
RUN uv sync --no-dev
6256

6357
# 4. Finally, for packages like sql_to_arc that exist both as a workspace dependency
6458
# and as a pre-built wheel, we explicitly 'uv pip install' the wheel. This ensures
6559
# we use our optimized, pre-built package instead of the 'editable' source install.
66-
RUN HATCH_VCS_PRETEND_VERSION=${APP_VERSION#v} \
67-
SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
68-
uv pip install /tmp/wheels/*.whl pyinstaller
60+
RUN uv pip install /tmp/wheels/*.whl pyinstaller
6961

7062
# Build standalone binary using the .venv's context.
7163
RUN . .venv/bin/activate && \

0 commit comments

Comments
 (0)