Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Build the Docker images from uv.lock

claude[bot]2a21ade6c313
diff --git a/Dockerfile b/Dockerfile
index a90a615..66c907c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -41,9 +41,10 @@ COPY mwmbl /app/mwmbl
COPY mwmbl_rank /app/mwmbl_rank
# Working directory is /app
-# Use uv to install the mwmbl python package including the mwmbl_rank Rust
-# extension. PEP 517/518 allows uv to use maturin as the build backend.
-RUN uv pip install --python /venv/bin/python .
+# Install from uv.lock so the image ships the versions the tests ran against: uv pip
+# install resolves against PyPI and ignores the lockfile (#403). --no-editable puts the
+# package in the venv rather than a link back to /app, which the final stage lacks.
+RUN UV_PROJECT_ENVIRONMENT=/venv uv sync --frozen --no-dev --no-editable
# Copy libxgboost.so (prebuilt by the xgb crate) into the mwmbl_rank package
# directory and patch the extension's RPATH so it finds the library at runtime.
diff --git a/Dockerfile.crawler b/Dockerfile.crawler
index ed72ba4..dce4297 100644
--- a/Dockerfile.crawler
+++ b/Dockerfile.crawler
@@ -27,8 +27,10 @@ COPY mwmbl /app/mwmbl
COPY mwmbl_rank /app/mwmbl_rank
# Working directory is /app
-# Use uv to install the mwmbl python package including the mwmbl_rank Rust extension.
-RUN uv pip install --python /venv/bin/python .
+# Install from uv.lock so the image ships the versions the tests ran against: uv pip
+# install resolves against PyPI and ignores the lockfile (#403). --no-editable puts the
+# package in the venv rather than a link back to /app, which the final stage lacks.
+RUN UV_PROJECT_ENVIRONMENT=/venv uv sync --frozen --no-dev --no-editable
# Copy libxgboost.so (prebuilt by the xgb crate) into the mwmbl_rank package
# directory and patch the extension's RPATH so it finds the library at runtime.
diff --git a/Makefile b/Makefile
index e775bf9..c228b1a 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ SODIR := .venv/lib/python3.11/site-packages/mwmbl_rank
XGB_SO := mwmbl_rank/target/release/deps/libxgboost.so
.PHONY: help install install-hooks patch-xgboost migrate test test-file run run-background \
- check fix format format-check lint lint-fix typecheck typecheck-all
+ check fix format format-check lint lint-fix typecheck typecheck-all locked
help:
@echo "Available targets:"
@@ -44,7 +44,7 @@ help:
@echo " run Start the Django development server"
@echo " run-background Start the background task processor"
@echo ""
- @echo " check Run every check CI runs: format-check, lint, typecheck"
+ @echo " check Run every check CI runs: format-check, lint, typecheck, locked"
@echo " fix Auto-fix what can be auto-fixed: format + lint --fix"
@echo " format Reformat the code with ruff"
@echo " format-check Check formatting without writing (CI gate)"
@@ -52,6 +52,7 @@ help:
@echo " lint-fix Run ruff lint checks, applying safe fixes"
@echo " typecheck Run ty, failing only on error-level diagnostics (CI gate)"
@echo " typecheck-all Run ty showing the full warning backlog, never fails"
+ @echo " locked Check uv.lock is up to date with pyproject.toml (CI gate)"
@echo " install-hooks Install the pre-commit hooks into .git/hooks"
install:
@@ -96,7 +97,7 @@ run-background:
# targets below in sync with .pre-commit-config.yaml and .github/workflows/ci.yml.
# ---------------------------------------------------------------------------
-check: format-check lint typecheck
+check: format-check lint typecheck locked
fix: format lint-fix
@@ -127,5 +128,11 @@ typecheck:
typecheck-all:
uv run ty check --exit-zero-on-warning
+# The Docker images install with `uv sync --frozen`, which takes uv.lock exactly as
+# committed, so a pyproject.toml edited without relocking would leave them building the
+# old dependency set. Nothing else catches that: `uv sync` relocks silently.
+locked:
+ uv lock --check
+
install-hooks:
uv run pre-commit install