Netlify can't build a images-rich Gatsby site

I have a gatsby site with over 2500 high-res images. I’m making use of gatsby-image to download all the images from a remote server and optimize them. This process generates more than 20000 thumbnails files!

On my local computer, the build task takes approximately 3 minutes. On Netlify, however, the build takes more than 15 minutes which eventually fails because of Netlify’s build time limit.

I decided to test a deploy on https://www.gatsbyjs.com. It succeeds with a build time of ~9 minutes.

Problem is I can’t use gatsbyjs.com service to push the build to Netlify because transferring all theses images takes forever.

What should I do here?

Gatsby’s build pipeline does a lot of things in parallel, by farming out your image processing to different build systems. They can do that, because they know exactly what to expect in the build (as in, they only build Gatsby).

Netlify can build pretty much anything, the downside of this is that the solution is not optimized for your use-case. I don’t think there’s a way around that, processing all those images one by one is going to take time.

Perhaps you can build the site locally, and then publish the build via the cli: https://www.netlify.com/blog/2019/05/28/deploy-in-seconds-with-netlify-cli/

hey, @Wdotis! we have just released a tutorial on how to set up parallel image processing for Gatsby sites on Netlify — in our tests, this solution tends to be a bit faster than Gatsby Cloud and avoids the need to transfer files, so it should work for you

let us know how it goes! :purple_heart:

1 Like

This is exactly what I needed! Now, deployment works again on Netlify with a build time of ~10min.

Thanks :pray:

1 Like

YAY! also, as we wrote in the article, this is a brand new project, so, if you experience any issues with it, any feedback is super helpful.