Deploying Jekyll Using Docker

Deploying Jekyll Using Docker

Devops   Give Your Opinion

Building and deploying a Jekyll website on Amazon S3

To build the website of Octoperf, our load testing tool, we use Jekyll. I also use it for this website.

It’s great to generate static content, hosted on Amazon S3 like OctoPerf or on Github for this blog. But we had trouble upgrading jekyll to version 3 on our build server. We use plugin that are not yet available for this version. So we had to revert back to 2.5.

Docker to the rescue

The whole process took us time. So I decided to use Docker to build, optimize and deploy our website. Now all we need is Docker installed on our build server and available in Jenkins, the Continuous Integration tool we use.

I wrote a simple script that:

#!/bin/sh

WORKSPACE=${1:-`pwd`}

docker run --rm -i -p $(docker-machine ip `docker-machine active`):4000:4000 -v=$WORKSPACE:/srv/jekyll jekyll/jekyll:2.5.3 /bin/sh -c "jekyll build"
cd $WORKSPACE/_site
find . -name "*.png" | xargs docker run --rm -v=$WORKSPACE/_site:/source buffcode/docker-optipng -o4
docker run --rm -i -v=$WORKSPACE/_site:/website -v=$WORKSPACE/conf:/config attensee/s3_website push --config-dir /config --site /website

Using Docker, we don’t need to maintain installations of ruby, rvm, gems, jekyll and so on. The build process may take a bit longer, but that’s not a big issue. I even started to use this solution on my laptop, to build the website locally.

By - CEO.
Tags: Amazon Jekyll Docker Cloud Jenkins Server

Comments

 

Thank you

Your comment has been submitted and will be published once it has been approved.

OK

OOPS!

Your post has failed. Please return to the page and try again. Thank You!

OK