Repository navigation
Description
Jira: RHOAIENG-51920
Summary
The vteam_claude_runner container image was bloated to 65GB in production (3.7GB locally). Root cause: incorrect Docker build context copying development artifacts including .venv directories (432MB) and unrelated components.
Fix: Added .dockerignore, corrected build context path, and updated COPY command.
Impact:
- Build context: 413MB → 70MB (83% reduction)
- Image size: 3.7GB → 2.8GB (25%+ reduction, potentially 95% in CI/CD)
Root Cause
The build context was set to ./components/runners/ (parent directory) instead of ./components/runners/claude-code-runner/, causing Docker to copy:
- 3 virtual environments (
.venv,.venv-langfuse,venv/) - 432 MBclaude_agent_sdk/_bundled/claude- 173 MB- macOS binaries (
.sofiles) - useless in Linux containers - Multiple
ruffbinaries - 22-29 MB each
- mcp-ambient-server/ subdirectory - 109 MB (unrelated component)
- Test files, lock files, and other dev artifacts
📊 Build Context Analysis (from diagnosis script)
Current (incorrect) build context: components/runners/
541M total
Top files copied:
173M .venv/lib/python3.13/site-packages/claude_agent_sdk/_bundled/claude
29M mcp-ambient-server/.venv/bin/ruff
22M .venv/bin/ruff
20M .venv/lib/python3.13/site-packages/cryptography/hazmat/bindings/_rust.abi3.so
20M mcp-ambient-server/venv/lib/python3.14/site-packages/cryptography/...
Build context transfer:
- Current (incorrect): 413.98 MB
- Fixed (correct): 70.86 MB
Changes Made
1. Added .dockerignore
File: components/runners/claude-code-runner/.dockerignore
Excludes:
- Virtual environments (
.venv/,.venv-*/,venv/) - Tests and coverage files
- Lock files (
uv.lock) - IDE files, logs, docs
2. Fixed Dockerfile
File: components/runners/claude-code-runner/Dockerfile (line 64)
- COPY claude-code-runner /app/claude-runner
+ COPY . /app/claude-runner3. Updated GitHub Actions Workflow
File: .github/workflows/components-build-deploy.yml (line 102)
- name: claude-code-runner
- context: ./components/runners
+ context: ./components/runners/claude-code-runner
image: quay.io/ambient_code/vteam_claude_runner
dockerfile: ./components/runners/claude-code-runner/Dockerfile4. Updated Makefile
File: Makefile (line 138-142)
build-runner:
- @cd components/runners && $(CONTAINER_ENGINE) build ... -f claude-code-runner/Dockerfile .
+ @$(CONTAINER_ENGINE) build ... -f components/runners/claude-code-runner/Dockerfile \
+ components/runners/claude-code-runnerExpected Results
After this fix:
- ✅ Build context: ~70 MB (vs 400+ MB)
- ✅ Image size: 2.5-2.8 GB (vs 65 GB or 3.7+ GB)
- ✅ Faster builds (less context transfer)
- ✅ No dev artifacts in production images
The 2.8 GB final size is normal for this stack:
- Base image (UBI9 Python 3.11): ~600 MB
- System packages (git, gh, Node.js): ~200 MB
- Python deps (160 packages): ~1.5 GB (anthropic[vertex], langfuse, fastapi, etc.)
Testing
A diagnosis script was created to reproduce and verify the fix locally. See attached files for:
- Full diagnosis report
- Build logs (before/after)
- Layer-by-layer comparison
🔍 How to verify the fix locally
cd ~/repos/platform
# Check build context size
tar -czf - -C components/runners/claude-code-runner . | wc -c | numfmt --to=iec-i
# Should show ~70-120 MB (vs 150+ MB before)
# Build image
docker build \
-t vteam_claude_runner:test \
-f components/runners/claude-code-runner/Dockerfile \
components/runners/claude-code-runner/
# Check size
docker images vteam_claude_runner:test
# Should show ~2.5-2.8 GBAction Items
- Add
.dockerignorefile - Update Dockerfile COPY command
- Update GitHub Actions workflow context
- Update Makefile build context
- Monitor next CI/CD build for size verification
- Update documentation if needed
Related
Commit: (will be added after PR)
cc: @jeder
Activity
jeremyeder commentedon Feb 7, 2026
Full Diagnosis Report
Attached is the complete diagnostic report from the bloat analysis script that reproduced and identified the issue locally.
Key metrics from diagnosis:
The diagnosis script builds both configurations and compares them layer-by-layer to identify exactly where the bloat occurs.
See the full report attached in the artifacts folder of the fix PR.
Gkrumbach07 commentedon Apr 6, 2026
Closing as part of backlog triage — 2026-04-06