Continuously Deploy a Hugo blog with GitHub Actions, Docker and a VPS

Disclaimer: In this tutorial I will just explain my solution for a problem that I had. If you have any suggestion feel free to contact me!

In August I decided to create a new blog where I can post some stories about Machine Learning, my idea is to publish these stories in italian (I’m a native speaker) because I believe that for some topics there are not a lot of informations in italian.

To create this blog I had some constraints:

To solve my problem I decided to use Hugo, an open source static site generator, Github Actions and Docker on my VPS.

Let’s see how to generate our Hugo website and continuously deploy it using Github Actions and Docker.

mkdir HugoTest
hugo new site HugoTest
git init
git add .
git commit -m "First commit"
git remote add origin<USERNAME>/<REPO>.git
git push -u origin master
git clone<USERNAME>/<REPO>.git


PROJECT_PATH is the path of the repo that you cloned on your VPS, in my case is /home/luca/TestHugo/TestHugo


The IP address of your VPS


The vps’s password


The username that you use to login to your VPS


The token you generated in the previous step.

git submodule add ./themes/harborecho 'theme = "harbor"' >> config.toml
docker-compose up 

If everything is ok you should see something like this:

If you connect to the IP of your VPS using the port 1313 you should also see your newly created blog:

hugo new post/
nano content/post/
docker-compose up -d


That’s all for today, I hope that this tutorial was useful for you, if so, clap your hands!

If you have any suggestions feel free to contact me on Twitter or just leave a comment here.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store