Publishing a static website with goHugo.io and dagger.io

Example project demonstrating Dagger.io CI/CD pipelines by building and optimizing a website with the Hugo static site generator and optimizing PNG images via pngquant.

This example was used for the introductory talk on dagger.io at the Technology Day 2022

Preparation

  • Clone this repository
  • Install a docker compatible engine (I successfully used Rancher Desktop)
  • Install the dagger-cue sdk
  • Get some webspace, which you can access via ssh and a public/private key pair.
    • I can recommend Uberspace
    • Create a dedicated key-pair for the deployment of the site without a passphrase): ssh-keygen -N "" -q -f ~/.ssh/id_rsa_deploy

Change config and deploy your content

  • Make sure the valid SSH private key lives under ~/.ssh/id_rsa_deploy or adapt the path
  • Adapt the remote configuration in blog.cue line 32
    remoteUser: "remote_user"
    remoteHost: "remote.host.local"
    remotePath: "/home/remote_user/html"
    
  • Change and uncomment the baseUrl / host in the Hugo config.toml to generate correct internal links.
  • Add / modify content for your site. Start at hugoContent/content/posts/hello/index.md

Do the deployment

  • dagger-cue do deploy
  • Change some content and deploy again ...