I'm fairly new to containers and I've tried using containers in the past, I've never really got the point, but I'm starting to see their worth. However, I don't like the idea of giving complete root access to the containers.
To get myself familiar with the whole concept I'm using Hugo, Hugo is one of the most popular open-source static site generators(Yep stole it from their website :D)
This assumes you have podman up and running on Centos or Archlinux or any distro of your choice, its fairly simple to setup if you need to.
Centos 7 or 8
yum install podman or dnf install podman
pacman -Syu podman or yay -Syu podman
sudo apt-get install hugo
So the official docs suggest installing hugo either on your local machine using your favorite package manager or you can use it via podman.
To get started I use the suggested docker image, its fairly simple to get started for example if you want to create a new hugo blog you can simply do this.
$ mkdir blog $ cd blog
podman run --rm -it -v $(pwd):/src:z klakegg/hugo:0.82.0 new site quickstart Trying to pull docker.io/klakegg/hugo:0.82.0... Getting image source signatures Copying blob e09912d331e4 done ... Writing manifest to image destination Storing signatures Congratulations! Your new Hugo site is created in /src/quickstart.
Where the flags mean the following
--rm Remove container after exiting -d Detach after running -i Interactive -t Provides a TTY -v $(pwd):/src:z This mounts the current working directory to the /src directory in the container. klakegg/hugo:0.82.0 Image Name "new site" Performs hugo new site quickstart Site Name
:z Are quite important when it comes to SELinux, basically
:z lets the containers change the SELinux contexts from what I've seen and the
:Z doesn't more information here Selinux With Containers. Please do not disable SELinux incase you get some errors. Remove the
:z if you're not using SELinux.
If the installation has completed successfully you should see the following.
Just a few more steps and you're ready to go: 1. Download a theme into the same-named folder. Choose a theme from https://themes.gohugo.io/ or create your own with the "hugo new theme <THEMENAME>" command. 2. Perhaps you want to add some content. You can add single files with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>". 3. Start the built-in live server via "hugo server". Visit https://gohugo.io/ for quickstart guide and full documentation.``` That's it you have your initial project ready!! Pat yourself on the back cause it was fun. In the next post I will show you how to create posts, install a theme and build the static site using hugo and then finally serve the websites using Apache, stay tuned.