Set memory limit when build

Hi I got error when build custom image n8n, i have memory 1GB on server, but when build new n8n with docker i got error out of memory like below

can help me to set memory limit when run build Dockerfile,

Thanks

Hi @ilhamakbar, welcome to the community!

I am sorry to hear you are having trouble here. Tbh, I am not sure if you can build a custom n8n docker image with <1 GB of memory, but have asked internally if anyone would be able to chip in on this.

Would you perhaps be able to use a pre-built docker image instead?

I got some feedback in the meantime, and it sounds like more memory would indeed be the most desirable option for building n8n (aside from using a pre-built image of course).

If this absolutely no option, you could alternatively try setting the NODE_OPTIONS environment variable to something like NODE_OPTIONS=--max_old_space_size=4096. But this would make the build incredibly slow as it would use swap space (and you’d obviously need available swap space, see for example here).

Actually one more thing. You can also use GitHub actions to do that. You canstart the build with the push of a button (or automatically, for example on push) anytime.

Here the Action we use at n8n:

1 Like