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:

  # Configure a standard apache webserver to host our site.
    # Use the most recent version of httpd service.
    image: tugboatqa/httpd:latest

    # Run these commands to initialize the server, update it with any libraries and assets required, then build your site.
      # Initialize the server.
        # Install node.js version 18.
        - apt-get update
        - apt-get install -yq ca-certificates curl gnupg
        - mkdir -p /etc/apt/keyrings
        - curl -fsSL | gpg --dearmor -o
        - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] nodistro main" |
          tee /etc/apt/sources.list.d/nodesource.list
        - apt-get update
        - apt-get install -yq nodejs

        # Set the webroot for to the Gatsby public folder.
        # Change this if you specify a different root for your public site.
        - ln -snf "${TUGBOAT_ROOT}/public" "${DOCROOT}"

      # Load dependent libraries and assets to prepare the site for build.
        # Run the node.js installer to install Gatsby and its dependencies.
        - npm install

      # Run any commands needed to build the site.
        # Build the static Gatsby site.
        - 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!