I’m working on a legacy app that has some node and some php.
I’m writing a Dockerfile more or less from scratch. It compiles locally as expected, and I can do fly deploy --local-only successfully. However, using the remote builder, I eventually get an out of memory when I reach the js bundling step (rollup
):
1.300 > rollup -c
1.300
2.142
2.142 src/main.js → public/build/bundle.js...
55.63
55.63 <--- Last few GCs --->
55.63
55.63 [31:0x54b4160] 53038 ms: Mark-sweep (reduce) 1952.0 (1994.3) -> 1951.5 (1994.8) MB, 204.6 / 0.0 ms (+ 822.3 ms in 185 steps since start of marking, biggest step 7.3 ms, walltime since start of marking 1227 ms) (average mu = 0.600, current mu = 0.356) [31:0x54b4160] 54317 ms: Mark-sweep (reduce) 1952.7 (1994.8) -> 1952.2 (1995.3) MB, 1275.6 / 0.0 ms (average mu = 0.386, current mu = 0.003) allocation failure scavenge might not succeed
55.63
55.63
55.63 <--- JS stacktrace --->
55.63
55.63 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
When I run this locally, I can see it peaks at around 16GB of memory usage, so I guess that’s what I need to expect the remote builder be able to handle.
What are some reasonable ways to proceed here?
I want to keep using the remote builder, but I also don’t want (or need) one that permanently sits there with 16GB+ of memory. I tried looking for options of specifying swap for the remote builder but couldn’t find any (besides maybe manually dumping the builder fly.toml and adding swap_size_mb?
I took a look at GitHub - fly-apps/dockerfile-node: Dockerfile generator for Node.js but it produces a Dockerfile more or less similar to what I already have, and I get the same error anyway.
Thoughts?