How to speed up gatsby site deployment on Netlify
Photo by Erik Brolin
How to speed up gatsby site deployment on Netlify
This weekend, I forked kentcdodds.com repository and made my personal website. This site used Gatsby and deploy to Netlify so I will do the same.
After 1 day to remove un-necessary things. I'm already to deploy my website to Netlify. The configuration just place in simple file netlify.toml
1[[headers]]2 for = "/rss.xml"3 [headers.values]4 Access-Control-Allow-Origin = "*"56[[plugins]]7 package = "netlify-plugin-gatsby-cache"89[build]10 command = "npm run netlify"11 functions = "public/functions/"
What is the netlify-plugin-gatsby-cache plugin? The answer from Jason Lengstorfl is "Persist the Gatsby cache between Netlify builds for huge build speed improvements! ⚡️"
This is the Repo. In there, we can get very detailed about how to install.
Basically, We have 2 ways to install plugin on your application:
- One click install from Netlify
- Install manually on
netlify.toml
. (This is option that I chose)
1[build]2 publish = "public"34[[plugins]]5 package = "netlify-plugin-gatsby-cache"
Next, We continue look and see what is the npm run netlify
do? This is a shortcut of gatsby-parallel-runner.
After spent 8 hours to setup Google Cloud Function that can use to run parallel gatsby images but I was fail.
And the article that help my life from Netlify is Gatsby Build Speed Improvements With Parallel Image Processing Follow step by step on the local development. I deployed success Google Cloud Function that can help speed up processing images.