Jekyll in a container
I like containers. I mean, I really like containers. It keeps my host clean from all the shitty things I try, allows me to isolate applications, is lightweight and so on. Pick one or more from these statements. So when I decided to setup a blog, the first thing I did was:
- looking for a blog engine.
- Dockerize it.
I didn’t want something depending on a database, just plain text file, where the content is separate from the container (the engine). I quickly found something which may feet my needs: Jekyll.
Jekyll is powerful and easy, it supports several markup languages, is maintained and widely used, sounds good to me!
To meet my second requirement, I just started to search for an upstream docker image (docker search and shit…). Found one (grahamc/jekyll) which looked simple and started to try it… Don’t want to blame anyone, but this docker image worked like 3-4 times and I suddenly got pigments.rb errors, tried to figure out what’s wrong (I’d like to say that I’m not what you can call a “ruby expert”), found that jekyll 3.x.x does not work well because of library dependencies.
To fix this, we need to modify the way we install three ruby gems (by explicitly setting versions):
- json (1.8.3).
- rake (10.5.0).
- jekyll (2.4).
And also remove jekyll 3.0.3.
At last, the docker image looks like this:
FROM ruby:2.1 MAINTAINER bmljb2xhc0Bha2lyYS5mcgo= RUN apt-get update \ && apt-get install -y \ node \ python-pygments \ && apt-get clean \ && rm -rf /var/lib/apt/lists/ RUN gem install \ json:1.8.3 \ rake:10.5.0 \ pygments.rb \ github-pages \ jekyll:2.4 \ jekyll-redirect-from \ markdown \ rdiscount \ rouge RUN gem uninstall --force -v 3.0.3 jekyll VOLUME /src EXPOSE 4000 WORKDIR /src ENTRYPOINT ["jekyll"]
To be honest, I don’t know what’s in the changelog between jekyll 2.4 and 3.0.3 and I don’t care for now because this works just fine and as I expected to.
So here is the beginning of this blog, we’ll see what is coming next…