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 18.
12        - apt-get update
13        - apt-get install -yq ca-certificates curl gnupg
14        - mkdir -p /etc/apt/keyrings
15        - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o
16          /etc/apt/keyrings/nodesource.gpg
17        - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" |
18          tee /etc/apt/sources.list.d/nodesource.list
19        - apt-get update
20        - apt-get install -yq nodejs
21
22        # Set the webroot for to the Gatsby public folder.
23        # Change this if you specify a different root for your public site.
24        - ln -snf "${TUGBOAT_ROOT}/public" "${DOCROOT}"
25
26      # Load dependent libraries and assets to prepare the site for build.
27      update:
28        # Run the node.js installer to install Gatsby and its dependencies.
29        - npm install
30
31      # Run any commands needed to build the site.
32      build:
33        # Build the static Gatsby site.
34        - npm run build

Want to know more about something mentioned in the comments of this config file? Check out these topics:

Start Building Previews!

Once this Tugboat configuration file is committed to your git repository, you can start building previews!