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:

services:
  # Configure a standard apache webserver to host our site.
  apache:
    # 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.
    commands:
      # Initialize the server.
      init:
        # Install node.js version 18.
        - curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
        - apt-get install -y 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.
      update:
        # Run the node.js installer to install Gatsby and its dependencies.
        - npm install

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