Jekyll on docker!
Using a few blog posts for inspiration, especially Davy’s Tech Blog with a few updates to make it work in 2021, and also on my MacBook M1 apple silicon.
I first started with github pages, which used Jekyll, markdown, which was awesome, then I added cloudflare in front to leverage their global CDN. However github pages only allow a few themes, understandabily, to keep their infra running smoothly. Now I’m hosting locally via Docker with the following steps, soon to push the web app via github to a cloud container, perhaps an Azure Web App on a free plan (F1).
Ok, why not run jekyll within MacOS? Well, you need ruby, gem, bundler, which can effect other applications on your main machine. A VM might be one solution, however managing multiple VMs with vulnerabilities, end of support dates and upgrades that may effect other parts of the VM or application. Docker is a smaller footprint, and I can lock certian parts of the build, such as the docker build/tag of stable, or in my case, 4.2.0. This jekyll docker image is made by the professionals in this area, is proven to be tried and tested with all dependacies built in.
What is Jekyll Jekyll is a static site generator, typically used for blogs. It processes a folder containing different items like posts, drafts, layouts and converts it into a fully fledged static html site that you can publish. The folder is typically stored in version control, and a build pipeline takes care of processing that folder and publishing a new site.
In order to process that folder, you need to have the jekyll executable and all of its dependencies.
jekyll new my-blog (to create a new folder structure) jekyll build (to process the folder structure, and generate an html site) jekyll serve (to run an http server on your local environment) However, as stated before, in order to run the jekyll executable on your environment, you’ll need to have a lot of dependencies in place.
What happened here ?
We’ve started a docker jekyll container We’ve mounted the current folder as /srv/jekyll in the container We’ve passed the jekyll new command A new site was created in the current folder by the container Because the volume was mounted on our host, the generated files end up on the host as well, take a look in your current directory.
To serve the new website locally, this seems to be enough to update with changes as edits are made, I’m using vscode.
Themes
I picked a theme from advice from jekyllrb.com and choose a popular but simple theme, jekyll-theme-yat. I installed via the Gemfile:
and _config.yml
Next steps will include github repo commits, push, github actions, and Azure Web Apps, some smooth CI/CD action. Perhaps CloudFlare Pages.