mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-12 22:55:45 +08:00
## 🚨 Urgent: this breaks the Docker image build for **every** open PR The `ragflow_tests_elasticsearch` and `ragflow_tests_infinity` jobs — 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): - https://github.com/infiniflow/ragflow/actions/runs/29086020168/job/86341032173 - https://github.com/infiniflow/ragflow/actions/runs/29086020168/job/86341032196 ## Symptom ``` Error: Cannot find module '/ragflow/web/scripts/prepare.js' npm error command sh -c node scripts/prepare.js ERROR: process "/bin/bash -c cd web && NODE_OPTIONS=..." did not complete successfully: exit code: 1 ``` ## Root cause `web/package.json` defines: ```json "prepare": "node scripts/prepare.js" ``` npm runs the `prepare` lifecycle script during `npm install`. But the frontend-deps layer in the `Dockerfile` only copies the package manifests before installing: ```dockerfile COPY web/package.json web/package-lock.json web/.npmrc ./web/ RUN ... cd web && npm install # runs `node scripts/prepare.js` → file not present yet ``` Since `web/scripts/prepare.js` is not in the image at that point, `npm install` aborts and the whole build fails. ## Fix Copy `web/scripts` before `npm install` so the `prepare` script is present: ```dockerfile COPY web/package.json web/package-lock.json web/.npmrc ./web/ COPY web/scripts ./web/scripts RUN ... cd web && npm install ``` - Minimal and safe: `scripts/prepare.js` only installs lefthook git hooks and already no-ops (wrapped in try/catch) inside the image where there is no Git repo. - Preferred over `--ignore-scripts`, which would also disable dependencies' legitimate install scripts. - `web/scripts` changes rarely, so build-cache impact on this layer is negligible. ## Verification Build reaches the frontend `npm install` step without the `MODULE_NOT_FOUND` error. No application code is touched — this is a build-infrastructure fix only.
13 KiB
13 KiB