mikelduke.com

Docker Jekyll Builder

I created a new project on Githib docker-jekyll-builder-git for a Docker containerized Jekyll project builder that I can run on a Heroku free Dyno. I put it together for use as part of a publishing pipeline instead of relying on the Github builder. This way I can use whatever plugins I want and can scp the built _site to my existing webhost. This lets me use my existing content and avoids having to change the DNS for my domain name.

Most of the other Jekyll builders I’ve found for Heroku rely on using either Rack or the Jekyll embedded server for serving content. Neither of these are really neccessary since it is just static content and any http server should do. You could instead use Apache or NGINX.

Running a static blog off an app dyno seems like a waste of resources unless you really need to scale it out dynamically. The content could just as easily be hosted on any other webhost or combined with other static sites. You would also need to upgrade to at least a hobby dyno ($7/mo) to avoid dyno sleeping for 6hrs/day, and the costs will add up with several sites.

I haven’t pushed the Docker image to Docker hub yet, but will once I’m happy with it and make things a little more flexible.

The image requires several environment variables and these can all be configured through Heroku’s web ui. Basically it will check out a git repo, run a bundle install and jekyll build, the scp the result somewhere else. You need to set the URLs to use and and SSH key for the transfers.

It can run as a bare docker image for use locally or on Heroku, instructions are in the readme or below. Next step is I want to make it run automatically after a push to github. I’ll make a php script on my webhost that can be hit from a webhook on Github that will then make the rest api call to Heroku and trigger a build.


jekyll-builder-git

Docker image to checkout a git repo, run a jekyll build, and the SCP the generated _site folder to somewhere else.

This lets you use a short lived free Heroku one-off dyno to build a Jekyll app that is hosted somewhere else.

Uses docker image jekyll/builder from https://github.com/jekyll/docker

Environment Variables

Set these variables in a run command or elsewhere:

Heroku

Heroku Trigger Script

The script run-heroku-jekyll-build.sh is an example Heroku API curl request to trigger the jekyll builder.

Docker

Exit mobile version