jibby0/jekyll-webhook
is a fork of cmrn/jekyll-webhook. This fork updates the Ubuntu version + supports Jekyll's newest packaging recommendations.
This is a docker image which:
- Builds a Jekyll site from source
- Runs an Nginx server to host the website
- Creates a GitHub webhook to pull in any new changes to the site
To start jibby0/jekyll-webhook
on port 80:
git clone https://github.com/jibby0/docker-jekyll-webhook
cd docker-jekyll-webhook
docker build -t jibby0/jekyll-webhook .
docker run -d -p 80:80 \
-e REPO="https://github.com/jibby0/blog.git" \
-e WEBHOOK_SECRET="change me" \
jibby0/jekyll-webhook
Set WEBHOOK_SECRET
to variable to a long, random passphrase, and set REPO
to the clone URL of your GitHub repository.
To set up the webhook in GitHub, go to your repository page, then go to Settings > Webhooks & Services > Add webhook. Set "Payload URL" to your server's address, followed by /webhook
- for example, https://jibby.org/webhook
. Set "Secret" to the same value as WEBHOOK_SECRET
. "Content type" should be "application/json", and the Webhook should only recieve the "push" event.
The image can be given the following configuration values as environment variables:
REPO
: Required. The clone URL for your Jekyll repository. If your repository is private, this should also contain a username and password.WEBHOOK_SECRET
: Required. The secret which authenticates genuine requests to the webhook. This should be a long, random secret shared only with GitHub.WEBHOOK_ENDPOINT
: Optional, defaults to/webhook
. The endpoint for the webhook. Change this if you want to publish something at the URL/webhook
.BRANCH
: Optional, defaults tomaster
. The branch to use from your repository. Another popular value isgh-pages
, used by GitHub Pages.
It's also possible to customise the nginx server configuration by linking in a new site.conf
template. Save site.conf
to your host machine, make your changes, and link it into your container:
docker run -d -p 80:80 \
-v /path/to/your/site.conf:/site.conf \
-e REPO="https://github.com/jibby0/blog.git" \
-e WEBHOOK_SECRET="change me" \
jibby0/jekyll-webhook
To allow for Gemfile
updates, this image runs bundle install
with each webhook pull. However, jekyll
is not restarted, as that means downtime. To update jekyll, update the Gemfile & restart the container.
This image overrides your repo's .bundle/config
to store the vendor
version in a predictable place. Gems will go in /vendor
.
To cache installed gems (and speed up redeploys tremendously), use -v /path/to/your/vendor:/vendor
.
This project is a concoction of:
Permission to use, copy, modify, and/or distribute this software is given under the ISC license.