Deploying Your Hugo Blog Development Server Using Podman/Docker Compose
Note that this container imagedeploys an old version of hugo and it may not be suitable for all deployments.
Thought that I’d play a little bit with the workflow of this site. Perhaps it will be useful to others. Although installing Hugo extended isn’t difficult. I’ve needed an environment that’s suitable for testing and reviewing before I deploy to the world.
Although Docker is still relevant to the world and I’ll still learn it. Ever since they started asking for more money. I shy away from it and started poking more at Podman. With that. There’s also podman-compose. Which is equally as effective at getting the job done. I haven’t run into a lot of issues with it other then some networking hiccups that I will discuss in a later post. Nothing major. Just annoying.
For the review portion of the workflow I will be utilizing podman/docker with podman/docker-compose. Which will make it easier because I won’t be limited to installing the software on every machine I get on. Just pull the container and allow it to do the work for me.
Eventually I would like to noodle the creation of new posts and make that a little more streamline. Another consideration is how to deploy to production should I decide to host it in a different manner. At this time, the bare minimum dev configuration is setup for the container.
Below is the Dockerfile used for deploying the dev container. The Dockerfile will utilize klakegg’s hugo:ext-alpine image and copy the entire directory into the src directory of the container.
FROM klakegg/hugo:ext-alpine
COPY . /src
Below is the docker-compose.yml file used for deploying the dev container. This will build a service named server that utilizes the klakegg/hugo:ext-alpine image, execute the hugo server command with a poll of 700ms, add a volume as the current working directory, and set the port to 1313.
version: 3
services:
server:
image: klakegg/hugo:ext-alpine
command: server --poll 700ms
volumes:
- ".:/src"
ports:
- "1313:1313"
It’s very simple. Just the way I like it. Though, I have yet to test it on a fresh environment. Something that I would also like to note. To those who have never used docker-compose or podman-compose. They both need to see the compose file.
After cloning the project there are a few commands that need to be
executed before seeing the site locally. This command will bring up the
container. To just deploy it without needing to interact with the
container. Add the -d
flag to deploy it.
podman-compose up
To tear down the stack. Execute the following command.
podman-compose down
With that. I think that covers the fun for this today. If I miss anything I’ll put an update on this. But, I think the next steps for this are to actually hone a production build so I can comfortably deploy this anywhere.