Deploying to Heroku
Heroku is a cloud platform as a service (PaaS) supporting several programming languages.
- A Gatsby project set up. (Need help creating one? Follow the Quick Start)
- A Heroku account
- The Heroku CLI installed
You can use the Heroku buildpack static to handle the static files of your site.
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.