2 simple tricks to speedup your gcloud build of a gatsby website
So we had some problems with our build and what we have is a gcloud
build that runs mainly gatsby build
.
I’ve spend 2 last days trying to first fix build timeouts and after that trying to speedup our build. And this is what we came to:
- we have had
gatsby
2.13.64
and first we have updated it to the highest available2.13.*
version which is2.13.83
right now. This helped us to fix an annoying build bug that prevented our build to finish after 40mins of running.
This also let us cut build time from 1h 5m to something around 45m. - after that we’ve switched to current node.js LTS version — which is
10.16.3
as of now — and this also impacted on the build time so that we came to something around 35–40m for a build.
This is how you can choose which node version to use duringgcloud
build from https://github.com/GoogleCloudPlatform/cloud-builders/blob/master/npm/README.md:
And that’s it.
~35% build time cut FOR FREE =)