fix(docker): lower default build memory#2420
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughParameterizes the Docker multi-stage build with CARGO_PROFILE and CARGO_BUILD_JOBS, adjusts builder-stage steps and caching to build with the selected profile, copies the built binary to /tmp/openhuman-core for runtime consumption, and documents an optional release-profile smoke build. ChangesDocker Build Parameterization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@gitbooks/features/cloud-deploy.md`:
- Around line 606-609: Update the docker build example that currently shows the
CARGO_PROFILE build-arg to also document the parallelism override by adding
guidance and an example for CARGO_BUILD_JOBS (e.g., mention using --build-arg
CARGO_BUILD_JOBS=1 for constrained builders or a higher value for faster
builds); update the sentence around the docker build command and include the
example alongside the existing docker build --build-arg CARGO_PROFILE=release -t
openhuman-core:release . so users see both CARGO_PROFILE and CARGO_BUILD_JOBS
usage and recommended values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7f8c88be-d05d-40c0-87d9-c7842551d52c
📒 Files selected for processing (2)
Dockerfilegitbooks/features/cloud-deploy.md
0cfd209 to
bdb35ef
Compare
graycyrus
left a comment
There was a problem hiding this comment.
Clean PR — no issues found beyond what CodeRabbit already flagged (and was addressed).
Nice fix for the OOM build failures. The approach is sound:
ciprofile (opt-level=1,codegen-units=16,lto=false) meaningfully reduces peakrustcmemory vsreleaseCARGO_BUILD_JOBS=1caps parallelism for constrained builderstarget/${CARGO_PROFILE}/correctly resolves for bothci→target/ci/andrelease→target/release/(custom Cargo profiles get their own directory even when inheriting)- The
/tmp/openhuman-coreintermediate copy decouples the finalCOPY --from=builderfrom the profile name — good move - Escape hatch via
--build-argis well-documented
LGTM.
Summary - Lowers the default Docker image build profile from
releaseto the crate'sciprofile to reduce peakrustcmemory. - SetsCARGO_BUILD_JOBS=1inside the builder stage so dependency builds do not fan out on small VPS/CI builders. - Copies the built binary from a stable/tmp/openhuman-corepath soCARGO_PROFILEcan still be overridden. - Documents--build-arg CARGO_PROFILE=releasefor operators who want the fully optimized build. ## Problem Issue #2419 showsdocker build -t openhuman:v11 .failing in the finalcargo build --release --bin openhuman-corestep. The compiler process exits withSIGKILL, which is the typical failure mode when the builder is killed by memory pressure rather than a Rust type or linker error. ## Solution - UseARG CARGO_PROFILE=ciby default in the Docker builder stage. The existingciprofile inherits release but uses lower optimization and fewer debug artifacts, reducing build memory. - UseARG CARGO_BUILD_JOBS=1and export it asCARGO_BUILD_JOBSto cap Cargo parallelism by default. - Keep an escape hatch:docker build --build-arg CARGO_PROFILE=release ...restores the old fully optimized profile. ## Submission Checklist - [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy - N/A: Dockerfile/docs change; Deploy Smoke CI builds and runs the image. - [x] Diff coverage >= 80% - N/A: no Rust/TS executable lines changed. - [x] Coverage matrix updated - N/A: deploy build behavior only, no feature row changed. - [x] All affected feature IDs from the matrix are listed in the PR description under ## Related - N/A: no matrix feature ID changed. - [x] No new external network dependencies introduced (mock backend used per Testing Strategy). - [x] Manual smoke checklist updated if this touches release-cut surfaces - N/A: cloud deploy docs updated with the build-profile override; release manual steps unchanged. - [x] Linked issue closed via Closes #NNN in the ## Related section. ## Impact - Docker builds become more reliable on low-memory builders. - Default Docker image build trades some runtime optimization for build reliability. - Operators can still request the old release profile explicitly with a build arg. - No runtime config, migration, or dependency change. ## Related - Closes #2419 - Follow-up PR(s)/TODOs: N/A --- ## AI Authored PR Metadata (required for Codex/Linear PRs) ### Linear Issue - Key: N/A - URL: N/A ### Commit & Branch - Branch: codex/2419-docker-low-memory-build - Commit SHA: bdb35ef71b6c6e4c2f465c51f90cd232e47156d2 ### Validation Run - [x]git diff --check- [x] Docker CLI availability checked:docker --version(blocked; see below) - [x] Focused tests: N/A - Dockerfile/docs only; CI Deploy Smoke is the executable validation. - [x] Rust fmt/check (if changed): N/A - [x] Tauri fmt/check (if changed): N/A ### Validation Blocked -command:docker --version-error:Docker CLI is not installed on this Windows worker (dockercommand not found). -impact:local Docker build/smoke could not run; GitHub Deploy Smoke should validate the Dockerfile build and health check. ### Behavior Changes - Intended behavior change: default Docker builds use the lower-memoryciCargo profile and one Cargo build job. - User-visible effect:docker build .is less likely to be killed on memory-constrained machines. ### Parity Contract - Legacy behavior preserved: fully optimized release builds remain available with--build-arg CARGO_PROFILE=release. - Guard/fallback/dispatch parity checks: entrypoint, runtime image, ports, env vars, and health check stay unchanged. ### Duplicate / Superseded PR Handling - Duplicate PR(s): N/A - Canonical PR: this PR - Resolution (closed/superseded/updated): N/ASummary by CodeRabbit
Documentation
Chores