I am using the 5 dollar plan to host mongodb, nginx, react node through docker and docker compose. The problem I have is that it keeps giving me

The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.

This image building starts with the backend and then react where this error occurs. The specific line it occurs is at


Step 5/9 : RUN yarn build
 ---> Running in e12af022dcf1
yarn run v1.22.5
$ react-scripts build
Creating an optimized production build...

I am using the multi-stage docker build for react and nginx

FROM node:alpine as build
WORKDIR /usr/app
COPY ./client .
RUN yarn install
RUN yarn build

FROM nginx:alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /usr/app/build /usr/share/nginx/html
``

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello there,

I will recommend you to inspect the memory usage using top , htop or sar and see if the memory usage is indeed high during the process.

You can also check the logs and see if there were killed processes and if the server was out of memory. In order to do that you can run the following commands

  • grep -i memory /var/log/messages
  • grep -i kill /var/log/messages

Regards,
Alex