Closed atomAltera closed 3 years ago
Sorry, I hadn't seen this earlier.
The error messages you see are those that webpack provides back to react-scripts to display. React-scripts alters how some of the webpack messages are displayed too - doing things like clearing the screen during the build. If they provide no messages to display, there is nothing react-app-rewired can do about it. :'(
By default, node.js will use up to around 1.4Gb Ram max when building unless you set a parameter to allow it to access more memory. It's possible that the OS inside the docker container is going into a kernel memory panic in the 2Gb Ram version, and auto-killing the webpack/node.js process as the "largest" process running in order to free up memory during the build. If the webpack process is killed, it doesn't get a chance to return log messages for display. You can check if this is the case using sudo dmesg | grep -i “killed process”
inside the running container that had been doing a build - if it has occurred, you should get a message line like "host kernel: Out of Memory: Killed process 2592
". This blog post has a good description of what the kernel out-of-memory (OOM) killer is and why it is present in the linux kernel at all.
I noticed a strange behavior when build docker image.
react-app-rewired build
exited without emitting files and no sign of error was made by script. Docker just continue to build an image. And only in production I got 404 error because there was lack of index.html and all js files.I played with docker config and what I have found: If I set Docker's RAM to 1GB and Swap to 510MB, script actually throws out of memory error and build is stopped:
But when I set RAM to 2GB (Swap still 512MB) script just exits without error:
Here is a listing of ./build/ dir in create docker image:
And only with 3GB of RAM an images is build successfully:
Here is a this project: https://github.com/atomAltera/letmeknow-server The problem is with a package in frontend dir.
I'm using Docker for mac. No other containers was run while building process.