TL;DR Reaction Commerce requires more than 2 GB of RAM to build
recommendation for reaction team:
add a note about minimum RAM needed to build an image to the requirements page https://docs.reactioncommerce.com/reaction-docs/master/requirements
While trying to build a vanilla clone of reaction using
reaction build <imageName> I ran into a strange error:
Step 1 : COPY . $APP_SOURCE_DIR
Step 1 : RUN cd $APP_SOURCE_DIR && bash $BUILD_SCRIPTS_DIR/build-meteor.sh && bash $BUILD_SCRIPTS_DIR/post-build-cleanup.sh
---> Running in ed8d087968dd
/opt/build_scripts/build-meteor.sh: line 16: 6 Killed npm i -g reaction-cli
The command '/bin/sh -c cd $APP_SOURCE_DIR && bash $BUILD_SCRIPTS_DIR/build-meteor.sh && bash $BUILD_SCRIPTS_DIR/post-build-cleanup.sh' returned a non-zero code: 137
No logs, stack traces or other info was available.
I noticed a couple of new docker images had been created, one of which had exited with the error code 137, so I started it up manually, shelled into it, and tried to run
build-meteor.sh myself to see what output I got.
It crashed, gave me no additional output, the docker container exited again with code 137.
I searched around the forums and couldn't find anything specific to this, but did find another thread which suggested I didn't have enough RAM. It says "600MB is pushing it", and here I was trying to do a build on a DigitialOcean droplet with only 512MB!
So I increased my RAM to 1 GB and tried again. It's hard to get exact requirements because the installation will use as much memory as is made available to it, but I used
watch -n5 free in a second shell to see what my memory looked like while the build was running. Sure enough, it was getting used up pretty quickly, and soon it crashed again. So I raised it to 2 GB. It did take longer this time, but again the memory was used up and the build failed.
At this point I gave up trying to do a build on my droplet, and am now doing them locally on my laptop.
Eventually I will automate this build process, but my ultimate goal here is to learn how to do a custom build with my own plugins, so for now I'm building manually.