Failed during stage 'building site': Build script returned non-zero exit code: 2

Seems like it’s right here:

I’ve never seen that before, but it is quite possible that you’re running out of memory - not sure how many pages you have or what settings you use in hugo. You might try hugo -vvv --gc -minify -b $URL to be more verbose, and then maybe you can see where it’s hanging. You should also try running locally in only 3Gb of memory to simulate our build env and you may find the same behavior on your own dev env…