Thanks a lot for the tip. I am trying right now and I will let you know about results on my side.
I have also tried switching my OS to Alpine with jemalloc.
It seems that the library that does image manipulation (sharp) has a known issue with bad memory management. And jemalloc seems to help with that.
Some reference here:
https://sharp.pixelplumbing.com/install#linux-memory-allocator
On my case it did make memory usage better, but my server was restarting with multiple uploads anyway… Now I will try your fix.