59 lines
3 KiB
Markdown
59 lines
3 KiB
Markdown
---
|
|
title: 'Using Hugo With Docker'
|
|
slug: using-hugo-with-docker
|
|
date: '2026-01-25T20:21:19Z'
|
|
categories: ["Web", "All"]
|
|
tags: ["Web", "HUGO", "Static Site"]
|
|
draft: true
|
|
---
|
|
|
|
Lately I've been going over the way I have things setup with my docker stacks and going over the stuff that I use and if that still makes sense for current me.
|
|
One of the things that stood out was my own homepage, the one you are reading this on. It was running on Wordpress before I started this article but hopefully will be made with [HUGO](https://www.gohugo.io/) from this point on.
|
|
|
|
In the ever changing landscape of the internet I was feeling less and less at home with Wordpress, it requires more upkeep then I would like, it's heavy, relies on lot's of third-party plugins with questionable security practices, and overall felt less of a good fit with how my views and skills have changed over time.
|
|
When looking around with what I wanted to use in it's place, [HUGO](https://www.gohugo.io/) came up again and again. I knew I wanted to go with a static site generator because of the security implications.
|
|
After all, I don't really need very much interactive features so just flat HTML + CSS makes sense and it makes it really hard to exploit with any PHP or SQL shenanigans.
|
|
|
|
Most other static site generator I found where still focused heavily on silicon valley concepts with massive amounts of mentions to tracking, interaction with cloud services, e-commerce ready, social media aware scale-out marketing bullshit.
|
|
All the stuff I hate about the modern web.
|
|
Sure [HUGO](https://www.gohugo.io/) has those options too, but it kept cropping up in all my searches, so I'm going to give it a go!
|
|
|
|
<!--more-->
|
|
|
|
## Okay, so it's going to be HUGO, now what?
|
|
|
|
HUGO's documentation on running with docker is a bit on the sparse side but I've managed to work it out enough to make a working deployment.
|
|
|
|
|
|
from project dir #/opt/hugo/
|
|
|
|
#### Test if container works version
|
|
```shell
|
|
docker run --rm -v .:/project -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:latest version
|
|
Expected:"hugo v0.154.5+extended+withdeploy linux/amd64 BuildDate=unknown VendorInfo=docker"
|
|
```
|
|
#### create new
|
|
```shell
|
|
docker run --rm -v .:/project -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:latest new site <NAME>
|
|
cd <NAME>
|
|
git init
|
|
#git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
|
|
echo "theme = 'phiaxnl'" >> hugo.toml
|
|
```
|
|
#### create content
|
|
```shell
|
|
docker run --rm -v .:/project -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:latest new content content/posts/my-first-post.md
|
|
```
|
|
#### run empty dev server
|
|
```shell
|
|
docker run --rm -v .:/project -u $(id -u):$(id -g) -p 80:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0" --noHTTPCache
|
|
```
|
|
#### build draft
|
|
```shell
|
|
docker run --rm -v .:/project -u $(id -u):$(id -g) -p 80:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0" --noHTTPCache --buildDrafts
|
|
```
|
|
|
|
|
|
#### Sources
|
|
https://gohugo.io/getting-started/quick-start/
|
|
https://github.com/gohugoio/hugo/pkgs/container/hugo
|