topics: docker (post)

Init Blog

Today I have finally found time to start looking into using Github Pages as a blog.

As a first step, I decided to find a good MIT Licenced theme. Having written a Jekyll theme previously, I am aware of the effort and time that is required to produce a good quality theme.

After a peruse of I found Pixyll to be my favourite with the Pixyll in Action blog post demonstrating all the features I expect to require.

With the theme chosen, I Git cloned locally, changed the origin to my Github Pages repository and pushed. A check of my Github Pages subdomain verified that it really is that simple.

As a next step I decided to start trying to tailor the blog slightly more to my liking, removing example posts / pages and tweaking the SCSS slightly.

After 2 commits to master it became quite obvious to me that I was pushing to see what would happen, mixing staging with production, lengthening the development / editorial cycle time and generally creating a rod for my own back.

I started playing with Jekyll quite some time ago and recalled the “jekyll server –watch” functionality that automatically rebuilds a static site when a file change is detected.

How can I replicate the Github Pages Jekyll environment?

Fortunately there is a pages-gem project, actively maintained with goals compatible with my requirements.

The goal of the GitHub Pages gem is to help GitHub Pages users bootstrap and maintain a Jekyll build environment that most closely matches the GitHub pages build environment.

The last time I investigated using Jekyll to build static sites, getting Jekyll to run locally was a bit of a pain on OSX. With the marching storm that is Docker now easily consumable on Mac and of course modern Linux Kernels, using Docker to build / develop this blog locally seemed the obvious choice.

I looked around for a Jekyll Dockerfile utilizing the pages-gem and found Starefossen docker-github-pages Dockerfile and tried it out.

$ docker run -v "$PWD":/usr/src/app -p "4000:4000" starefossen/github-pages

Unfortunately, this did not work returning the error:

Conversion error: Jekyll::Converters::Scss encountered an error while converting ‘/css/pixyll.scss’: Invalid US-ASCII character “\xC2” on line 7

Fortunately someone else had stumbled across this issue with a recommended resolution the addition of an environment variable to the Dockerfile


Consequently I have a very basic Dockerfile included in this repo:

FROM starefossen/github-pages

I am now able to preview changes as I make them, hopefully with a sufficiently similar environment to that used by Github Pages.

In the future I would like to be able to run a build before deploying, potentially running a spell checker and validating links are still active.

This blog post describes using Travis and html-proofer together, which looks like it might be a good first step…