I am in the process of moving my messy VPS to a more modular and hopefully neater system with Docker. I notice that Docker Hub has several Hugo images - does anybody know which might be the best? On my current un-Dockerized system I simply bung everything into my home directory, and I’ve created an Apache site with a very simple configuration that just points to it. I’m still learning about Docker, so any advice is helpful! Thanks.
Here is the Docker image which I use for my projects. I know this image is very big, but it works fine for me.
https://hub.docker.com/r/joergklein/hugo/
I am a GitLab user and I use a .gitlab-ci.yml to automate test, build and deploy my Hugo projects. I push to GitLab and GitLab delivers the project to my hoster. On my local maschine I have no Docker installed.
In your .gitlab-ci.yml you can write
image: joergklein/hugo:latest
It’s pretty trivial to build your own docker image with a bit of prodding about. Here’s mine
This uses the node base image since I also do some asset building (this theme is pre hugo support of pipelines). I install hugo into it and I copy all the static stuff out into a new nginx image using multistage config. This is the one that gets deployed to my server to be run. My final image ends up being pretty small.
Thanks very much! Actually, since the whole point of Hugo is that it’s a static website, it should be a relatively simple matter to create a tiny Docker container (using Alpine and nginx) to serve it up as a web page. Maybe I’ll try this, when I have a bit of time… (and know more about Docker!)
There’s a Dockerfile
in the Hugo repo that builds the binary to a scratch container. That’s about as small as it gets. The problem with scratch is that there’re no shell utils like your used to on your VPS so you may want a BusyBox or Alpine base image. Since your just starting to learn I’d look an what others (above) are doing and reference the Docker docs (quite excellent IMO). And if you want that BusyBox image you can version edit this and simply replace scratch
with busybox
then docker build .