-
Notifications
You must be signed in to change notification settings - Fork 31
refactor: migrate claude-code-runner Dockerfile to use uv and uv.lock #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add uv installation from official ghcr.io image - Replace pip install with uv pip install for runner-shell - Use uv sync --frozen --no-dev for claude-runner dependencies - Update CMD to use uv run --frozen for reproducible execution - Set UV_SYSTEM_PYTHON=1 for system Python compatibility - Copy uv.lock to ensure locked dependency versions Benefits: - Faster build times with uv's optimized dependency resolution - Reproducible builds via uv.lock - Better caching and smaller image layers
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Copy claude-runner files including uv.lock | ||
| COPY claude-code-runner/pyproject.toml claude-code-runner/uv.lock /app/claude-runner/ | ||
| COPY claude-code-runner/wrapper.py /app/claude-runner/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy CLAUDE.md required by uv sync
The Docker build now only copies pyproject.toml, uv.lock, and wrapper.py into /app/claude-runner, but pyproject.toml declares readme = "CLAUDE.md". When uv sync --frozen --no-dev runs later in the Dockerfile, uv/setuptools will try to read that file while building project metadata and fail with FileNotFoundError, so the image cannot be built. The previous Dockerfile copied the entire claude-code-runner directory (including CLAUDE.md), so this build failure is newly introduced.
Useful? React with 👍 / 👎.
…entation and caching - Add build context documentation at top of file - Optimize layer caching by separating dependency files from application code - Add comprehensive inline comments explaining: * Why UV_SYSTEM_PYTHON=1 is needed * Build context requirements * Why 'uv sync' vs 'uv pip install' * Why '--frozen' flag is important * Why 'uv run' is necessary (venv isolation) - Verify CI workflow already uses correct build context Addresses all feedback from Claude Code Review: - Build context documentation (Major Issue #1) ✅ - Layer optimization (Minor Issue ambient-code#3) ✅ - Command documentation (Minor Issue ambient-code#4) ✅ - Inline comments (Minor Issue ambient-code#5) ✅ CI verification confirms: - context: ./components/runners - dockerfile: ./components/runners/claude-code-runner/Dockerfile
Addressed PR FeedbackThank you for the comprehensive review! I've addressed all the recommendations: ✅ CompletedMajor Issues:
Minor Issues:
🧪 Testing✅ Built successfully with podman: cd components/runners
podman build -f claude-code-runner/Dockerfile -t vteam-claude-runner:test .✅ Verified all key dependencies are available:
✅ Confirmed layer caching optimization works - most layers cached on rebuild Ready for merge! 🚀 |
Claude Code ReviewSummaryThis PR successfully migrates the claude-code-runner Dockerfile from pip to uv for faster, more reproducible builds. The implementation follows best practices with proper layering and caching. However, there are critical issues that need attention before merging. Issues by SeverityBlocker Issues1. Missing uv.lock file validation
2. Inconsistent package management
Critical Issues3. UV_SYSTEM_PYTHON=1 bypasses isolation
4. Build context documentation
Major Issues5. Missing error handling for uv sync
6. No uv installation validation
7. Incomplete migration docs
Positive Highlights✓ Excellent layering: Dependencies before code RecommendationsMust Fix Before Merge:
Should Fix: Nice to Have: ConclusionSolid migration with good structure. Main concerns: runner-shell consistency and reproducibility. Once blockers addressed, this will significantly improve build times. Recommendation: Request changes for blockers 1 and 2 |
Response to Latest Review CommentsThank you for the detailed review! Let me address the concerns: Blocker Issues1. ✅ Missing uv.lock file validation
2. 🤔 Inconsistent package management
Critical Issues3. ✅ UV_SYSTEM_PYTHON=1 bypasses isolation
CI Status✅ All checks passing:
The build system validates that:
RecommendationThe current implementation is production-ready:
Suggested path forward:
What do you think? 🤔 |
The pyproject.toml referenced 'readme = "CLAUDE.md"' but this file does not exist in the claude-code-runner directory. While uv handled this gracefully during build, it's a latent bug that could cause issues. Changes: - Removed readme field from pyproject.toml - Regenerated uv.lock to reflect the updated metadata The build and runtime tests pass successfully with this fix. Addresses feedback about missing CLAUDE.md file during layer optimization.
Fixed: Missing CLAUDE.md ReferenceGood catch! You were absolutely right about this issue. The ProblemThe readme = "CLAUDE.md"But Why my builds succeeded: uv appears to handle missing readme files gracefully (it's optional metadata), so the build didn't fail. However, this is still a latent bug that should be fixed. The Fix✅ Removed the Testing# Build test
cd components/runners
podman build -f claude-code-runner/Dockerfile -t test .
# ✅ SUCCESS
# Runtime test
podman run --rm test bash -c "cd /app/claude-runner && uv run --frozen python -c 'import anthropic; import claude_agent_sdk; print(\"OK\")'"
# ✅ All dependencies workingThank you for catching this! 🙏 |
Changes
This PR refactors the claude-code-runner Dockerfile to use
uvanduv.lockfor faster, more reproducible builds.What Changed
uvinstallation from official ghcr.io imagepip installwithuv pip installfor runner-shelluv sync --frozen --no-devfor claude-runner dependenciesuv run --frozenfor reproducible executionUV_SYSTEM_PYTHON=1for system Python compatibilityuv.lockto ensure locked dependency versionsBenefits
uvis significantly faster thanpipuv.lockensures exact dependency versions across all buildsTesting
Related
uvfor Python package management