I updated my Docker image of Jekyll plus LiveReload. Even though the most recent version of Jekyll supports LR built-in, this is still a good setup for building custom Gems if you're not a Ruby dev.

A few years ago I started to rewrite my blog (this blog) with a static site generator. Jekyll is what's used for Github Pages so I thought I would give that a try. It turns out that getting LiveReload functionality in jekyll was kind of a pain, so I made a docker image to set everything up right: https://hub.docker.com/r/markkimsal/jekyll-plus/

When trying to get jekyll-paginate-v2 plugin working, I had to re-build my docker image. Rather than rebuild the image everytime I wanted a new plugin, I decide to make the image able to install any plugin from any Gemfile. I had to install the ruby program "builder". Having builder installed would let me install gems from any Gemfile.

I ran into a problem with libffi (or ffi gem). The latest version 1.9.21 would not install on Ubuntu 14.04 because it needed some automake tools. Here's the exact error in case you're running into this same problem.

ERROR:  Error installing ffi:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.2 -r ./siteconf20180209-7-1v885si.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
Running autoreconf for libffi
/var/lib/gems/2.2.0/gems/ffi-1.9.21/ext/ffi_c/libffi/autogen.sh: 2: exec: autoreconf: not found
make: *** ["/var/lib/gems/2.2.0/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-linux-gnu"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.2.0/gems/ffi-1.9.21 for inspection.
Results logged to /var/lib/gems/2.2.0/extensions/x86_64-linux/2.2.0/ffi-1.9.21/gem_make.out

The solution is to just force the last known working version of ffi 1.9.18

RUN gem install ffi --version '=1.9.18' --platform ruby 

This line needs to be before installing the gem guard or jekyll in your Dockerfile.

But the latest version of Jekyll has LiveReload support built-in. Happy days!

The docker image is still usefull for setting up a Ruby environment with bundler support. You can install any jekyll plugins for a Gemfile in your projects root with.

docker run --rm -v "$PWD:/src" \ 
  markkimsal/jekyll-plus bundle install

But, given the triviality of LiveReload support in Pulp it might be time to write my own static site generator in PHP with Smarty templates. I'm always still fighting the liquid template syntax to do things that I'm comfortable doing in Smarty.