This is a fork from https://github.com/DonMcNamara/dockerfiles/tree/master/dockerjekyllpages which is built at https://hub.docker.com/r/dmcnamara/dockerjekyllpages/
This repo is built at https://hub.docker.com/r/whitegecko/dockerjekyllpages/
This is a docker image to build a Jekyll page from a Git repository. This is essentially githubpages in a docker image. This docker image uses nginx, Jekyll, uwsgi and supervisor.
Configuration of docker image
The git repository URL is passed as an environment variable to the docker image.
The environment variable is named
REPO, also a branch to build can be specified using the variable
Alternatively the container can be linked to a volume at
/data/jekyll/source which contains the Jekyll page to build.
Use SSH Authentication
If you want to clone private git repositories your might want to forward your private SSH key resp. the SSH Authentication Socket.
Per default the
SSH_AUTH_SOCK environment variable is set to
/var/run/ssh-agent.sock in this image thus you only have to mount the hosts
SSH_AUTH_SOCK to the container by adding the argument
If you don't have an
SSH_AUTH_SOCK running on the docker host you can also mount the
id_rsa-file e.g. with
In the case that you are mounting a private key rather then using the hosts SSH agent it is a good idea to generate a key without password.
Usually you also want to tell the known hosts to the container so it doesn't prompt for the decision.
You can do this by mounting the hosts
To initiate a rebuild, you can use your browser to load http://yourserver/cgi/buildsite.sh
For an automatic build, you can set up a git service hook that posts to that URL on a git push. Your site will rebuild when you push changes to your repository.
Per default the site will be hosted on port 80. This is especially useful in combination with a proxy container e.g. the one from jwilder.
If you want to serve you site locally you can map it e.g. to port 8080:
sudo docker run -p 8080:80 -e REPO=[YOUR REPO URL HERE] -e BRANCH=[YOUR BRANCH] whitegecko/dockerjekyllpages
Authenticity can't be established
If you experience that
./buildsite.sh never ends and if you run it manually you get the following output:
The authenticity of host 'github.com (22.214.171.124)' can't be established. RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. Are you sure you want to continue connecting (yes/no)?
You are using a ssh remote URL.
There are two solutions:
- Use a HTTPS URL for the remote instead
- Include a
known_hosts-file as explained above in the "Use SSH Authentication"-section
- Remove debian packages which are not used
- Update base image to ubuntu:zesty, latest and saves space
- Remove apt list cache after installation with apt-get (should save some space)
0.3.0 Add Support for private SSH repositories
- Set SSH_AUTH_SOCK environment variable per default
- README: Explain how to forward the respective SSH resources to the container
0.2.0 Some Improvements
- Update base image, ruby and thus jekyll
- Reorganize file structure
- NGINX: also serve pages without .html
- NGINX: deliver 404 status codes
- NGINX: serve custom 404 pages
- Build process: install dependencies from Gemfile
- Build process: specify branch to checkout
- Build process: build from volume
- Update README
0.1.0 Initial release.
- It seems to work.