Repository navigation
fix(docker): [URGENT] Docker build fails for all PRs - missing web/scripts/prepare.js during npm install - #16821
Conversation
…ists The web `prepare` lifecycle script runs `node scripts/prepare.js` during `npm install`, but the frontend-deps layer only copied the package manifests. The build failed with "Cannot find module web/scripts/prepare.js", breaking the image build for every PR. Copy web/scripts before npm install so the prepare script is present.
|
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 (1)
📝 WalkthroughWalkthroughThe Dockerfile builder stage now copies ChangesFrontend build preparation
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
Pull request overview
Fixes Docker image builds in CI by ensuring the frontend npm install step has access to web/scripts/prepare.js, which is required by the prepare lifecycle script in web/package.json.
Changes:
- Copy
web/scriptsinto the Docker build context before runningnpm installinweb/. - Add inline documentation in the Dockerfile explaining why
web/scriptsmust be present prior tonpm install.
| # Install frontend dependencies — depends only on package manifests so | ||
| # web source / docs changes don't invalidate this layer. |
🚨 Urgent: this breaks the Docker image build for every open PR
The
ragflow_tests_elasticsearchandragflow_tests_infinityjobs — which build the image before running tests — currently fail on all pull requests, not just this one. CI is effectively red repo-wide until this lands. Please review and merge ASAP.Example failing runs (from an unrelated PR):
Symptom
Root cause
web/package.jsondefines:npm runs the
preparelifecycle script duringnpm install. But the frontend-deps layer in theDockerfileonly copies the package manifests before installing:Since
web/scripts/prepare.jsis not in the image at that point,npm installaborts and the whole build fails.Fix
Copy
web/scriptsbeforenpm installso thepreparescript is present:scripts/prepare.jsonly installs lefthook git hooks and already no-ops (wrapped in try/catch) inside the image where there is no Git repo.--ignore-scripts, which would also disable dependencies' legitimate install scripts.web/scriptschanges rarely, so build-cache impact on this layer is negligible.Verification
Build reaches the frontend
npm installstep without theMODULE_NOT_FOUNDerror. No application code is touched — this is a build-infrastructure fix only.