Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

Deploying to Heroku

You can use the heroku buildpack static to handle the static files of your site.

Set the heroku/node.js and heroku-buildpack-static buildpacks on your application.

You can optionally add the buildpacks to app.json if you want to take advantage of the heroku platform API

Heroku will automatically detect and run the build script from your package.json which should already look like this:

Finally, add a static.json file in the root of your project to define the directory where your static assets will be. You can check all the options for this file in the heroku-buildpack-static configuration.

The following configuration will give you a good start point in line with Gatsby’s suggested approach to caching.

Edit this page on GitHub
© 2024 Gatsby, Inc.