Docker image that builds hosts a Gatsby site
This image has two major tags:
-
latest- will serve your assets on production using up an nginx server -
onbuild- builds your project and creates a new docker image
- Insert the
Dockerfileabove at the root of your project:
FROM gatsbyjs/gatsby:onbuild-
Build your project's public assets with
gatsby build -
Build your project's docker image:
docker build -t myproject/website .- Upload to the registry
docker push myproject/website- Use it
docker run --rm myproject/website