fix(build): Stop shipping worktree checkouts as build context - #370
Conversation
target/ is root-anchored, so it never matched .worktrees/*/target/ or .claude/worktrees/*/target/. Both worktree roots live inside the main checkout, so every build run from there streamed them as build context. They currently hold 508 GB. Verified against a fixture: with only target/ excluded, an exported image contained .worktrees/wt1/target/big.bin and .claude/worktrees/wt2/target/big.bin; with both patterns added it contained neither. Builds run from inside a worktree are unaffected. Every recipe uses the current checkout as its context root, and a worktree holds no nested worktrees, so the patterns match nothing there.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Docker ignore configuration now uses root-anchored patterns for ChangesDocker ignore rules
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to Build contexts now omit nested worktree directories, preventing their contents from being sent to Docker builds. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code Review ✅ ApprovedExcludes OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
There was a problem hiding this comment.
🟢 Approval recommended
The change is small and scoped to build-context exclusion patterns, with only a minor doc/comment clarity tweak suggested.
Pull request overview
This PR reduces container build context size by excluding Git worktree checkouts that live inside the main repository checkout, preventing nested worktrees (and their artifacts) from being streamed into docker build/podman build contexts.
Changes:
- Add
.dockerignorerules to exclude.worktrees/and.claude/worktrees/from the build context.
File summaries
| File | Description |
|---|---|
.dockerignore |
Excludes nested worktree directories from container build contexts to avoid shipping large unintended content. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
.worktrees/and.claude/worktrees/from the build contexttarget/is root-anchored, so it never matched.worktrees/*/target/or.claude/worktrees/*/target/; both roots live inside the main checkout and hold 508 GB todaytarget/excluded, an exported image contained both nestedtarget/trees; with these two patterns it contained neitherSummary by CodeRabbit