[Question]: Exception in source code Docker image printing
Self Checks
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (Language Policy).
- [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
- [x] Please do not modify this template :) and fill in all the required fields.
Describe your problem
I am executing the command: docker build --platform linux/amd64 --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=0 -f Dockerfile -t infiniflow/ragflow:nightly-slim .
When creating Docker images, execute: RUN -- mount=type=cache, id=ragflow_npm, target=/root/. npm, sharing=locked
An exception occurred during the installation and run build of CD web&&&npm. The exception information is as follows:
=> ERROR [builder 6/8] RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked cd web && npm install && npm run build 214.3s
[builder 6/8] RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked cd web && npm install && npm run build: 14.46 14.46 > postinstall 14.46 > umi setup 14.46 16.53 info - [你知道吗?] father 4 正式发布了,详见 https://zhuanlan.zhihu.com/p/558192063 16.54 info - generate files 17.90 info - Preparing... 20.00 info - [icons] no icons was found 22.05 22.05 > prepare 22.05 > cd .. && husky web/.husky 22.05 22.10 .git can't be found 22.12 added 8 packages in 21s 22.12 22.12 134 packages are looking for funding 22.12 run
npm fundfor details 22.34 22.34 > build 22.34 > umi build 22.34 23.60 info - [你知道吗?] 如果你有 MPA(多页应用)需求,可尝试新出的 mpa 配置项,详见 https://umijs.org/docs/guides/mpa 23.60 info - Umi v4.2.3 24.47 info - Preparing... 25.62 info - [icons] no icons was found 26.10 Browserslist: caniuse-lite is outdated. Please run: 26.10 npx update-browserslist-db@latest 26.10 Why you should do it regularly: https://github.com/browserslist/update-db#readme 26.14 26.14 Rebuilding... 27.02 27.02 Done in 926ms. 27.06 info - [plugin: ./node_modules/@umijs/plugins/dist/tailwindcss] tailwindcss service exited 30.14 Browserslist: caniuse-lite is outdated. Please run: 30.14 npx update-browserslist-db@latest 30.14 Why you should do it regularly: https://github.com/browserslist/update-db#readme 30.64 ℹ Compiling Webpack 52.25 [BABEL] Note: The code generator has deoptimised the styling of /ragflow/web/src/assets/svg/login-avatars.svg as it exceeds the max of 500KB. 213.9 Killed
Dockerfile:166
165 | COPY docs docs
166 | >>> RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked
167 | >>> cd web && npm install && npm run build
168 |
ERROR: failed to solve: process "/bin/bash -c cd web && npm install && npm run build" did not complete successfully: exit code: 137
How should I handle this issue? Thank you for your help
The error with exit code 137 means the build process was killed, almost always due to running out of memory inside the Docker container. This is common when building modern JavaScript apps with tools like Umi/Webpack, which can be memory-intensive during npm run build citation.
To fix this:
- Increase the memory allocated to Docker. For example, if you're using Docker Desktop, raise the memory limit in the Docker settings.
- Try building the
slimversion of the image, which uses less RAM since it doesn't load a local embedding model citation. - If you keep hitting memory issues, consider splitting the build into smaller steps or reducing the number of parallel processes (for example, set
NODE_OPTIONS="--max-old-space-size=2048"before running the build to limit Node's memory usage). - If you see network or mirror errors, use
--build-arg NEED_MIRROR=0to avoid unreliable mirrors citation.
If you want to clean up before retrying, you can delete src/.umi, src/.umi-production, and node_modules in the web directory, then run npm install and npm run build again citation.
Let me know if you need more details on any of these steps.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other