Gatsby Static Site
Deploy your static Gatsby site with Tugboat.
Configure Tugboat for Gatsby
The Tugboat configuration is managed by a YAML file at
.tugboat/config.yml in the git repository. Here’s a basic static HTML configuration you can use as a starting point,
with comments to explain what’s going on:
1services:
2 # Configure a standard apache webserver to host our site.
3 apache:
4 # Use the most recent version of httpd service.
5 image: tugboatqa/httpd:latest
6
7 # Run these commands to initialize the server, update it with any libraries and assets required, then build your site.
8 commands:
9 # Initialize the server.
10 init:
11 # Install node.js version 24.
12 - apt-get update
13 - apt-get install -y curl
14 - curl -fsSL https://deb.nodesource.com/setup_24.x -o /tmp/nodesource_setup.sh
15 - bash /tmp/nodesource_setup.sh
16 - apt-get install -y nodejs
17
18 # Set the webroot for to the Gatsby public folder.
19 # Change this if you specify a different root for your public site.
20 - ln -snf "${TUGBOAT_ROOT}/public" "${DOCROOT}"
21
22 # Load dependent libraries and assets to prepare the site for build.
23 update:
24 # Run the node.js installer to install Gatsby and its dependencies.
25 - npm install
26
27 # Run any commands needed to build the site.
28 build:
29 # Build the static Gatsby site.
30 - npm run buildWant to know more about something mentioned in the comments of this config file? Check out these topics:
- Name your Service
- Specify a Service image
- Leverage Service commands
- Define a default Service
- Set the document root path
- Preview build process phases (
init,update,build)
Start Building Previews!
Once this Tugboat configuration file is committed to your git repository, you can start building previews!