Created
January 31, 2014 07:23
-
-
Save mrryanjohnston/8727858 to your computer and use it in GitHub Desktop.
Running Jekyll from a Docker container. Uses a busybox container to host the Jekyll data (see http://docs.docker.io/en/latest/use/working_with_volumes/).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming your Jekyll site is currently in ~/blog | |
$ sudo docker run -v /home/yourusername/blog:/src -name BLOG-DATA busybox true | |
# Using the Dockerfile in the current dir | |
$ sudo docker build -t ubuntu-jekyll . | |
# Run this container as a daemon using the volumes from the BLOG-DATA container, | |
# forwarding the container port 4000 to the host port 4000. | |
$ sudo docker run -volumes-from BLOG-DATA -d -p 4000:4000 -name jekyll ubuntu-jekyll | |
# Now you can edit your Jekyll site in the host with your favorite editor without installing Ruby in the host! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:12.04 | |
#Install Ruby | |
RUN apt-get update | |
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install ruby1.9.1 ruby1.9.1-dev make | |
#Pygments doesn't seem to want to work regardless of version installed | |
RUN gem install pygments.rb | |
#Install Jekyll | |
RUN gem install jekyll | |
WORKDIR /src | |
EXPOSE 4000 | |
CMD ["jekyll", "serve", "--watch"] |
Hi, I've just tried and javascript runtime was missing.
Adding nodejs to apt-get dependencies solves this issue :). Thanks for dockerfile.
I saw your comment about Pygments not working. I was able to clear it up and use GFM fenced code blocks using kramdown-with-pygments plug-in. Here's my _config.yml
for reference.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sources I used to figure this stuff out (thanks!):
https://workshop.avatarnewyork.com/post/jekyll-up-and-running-with-docker/
https://github.com/Painted-Fox/dockerfiles/blob/master/jekyll.docker
https://www.digitalocean.com/community/articles/docker-explained-using-dockerfiles-to-automate-building-of-images
http://docs.docker.io/en/latest/commandline/cli/
http://docs.docker.io/en/latest/use/working_with_volumes/