Deploy Gatsby on Light Cloud - detected from gatsby-config, built to public, and served from the global CDN with free bandwidth.
Deploy Gatsby
Gatsby is detected from its dependency and gatsby-config, and deploys as a static site: npm run build fills public/, and the CDN serves it with free bandwidth. No server, no region, no cold starts.
Build#
- Output directory:
public- Gatsby's fixed output. - Install: follows your lockfile - see How detection works.
- Source plugins that pull from CMSs and APIs run during the build, so their credentials must be available then - which they are: static builds run with the environment's variables set.
Environment variables#
GATSBY_* values inline into the browser bundle; unprefixed variables stay build-side (gatsby-node, source plugins), per environment - a preview can build against a staging CMS space.
Warning
GATSBY_* values ship to every browser - CMS delivery tokens for public content are usually fine, management tokens never are.
Rebuilding on content changes#
Builds trigger on push. Content edited in a headless CMS becomes visible on the next deploy - push a commit or press Redeploy on the environment. See Rollbacks and redeploys.