Skip to content

peteretelej/jekyll-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 

Repository files navigation

Jekyll Docker Container

An optimized jekyll docker image (etelej/jekyll) for building Jekyll containers for Github Pages. Helpful in developing manually built Jekyll Github Pages without much overhead, or having to install Jekyll's multiple dependencies.

Creating the Jekyll container:

Simply run this command from within your githubpages directory:

docker run --rm -it -p 4000:4000 -v "$PWD":/app -w /app etelej/jekyll 

How it works:

This creates a disposable container (--rm), emulates an interactive terminal (-it), forwards host's port 4000 to container's port 4000 (-p 4000:4000 ), maps working directory on host to a read-write volume in container (-v "$PWD":/app), sets the mapped volume as the working directory (-w /app), creates container from the docker image (etelej/jekyll:latest) and starts the jekyll server as the main docker process (bundle exec jekyll serve defined in Dockerfile).

Method 2: Compose Usage (using docker-compose)

To use docker-compose via the repo's docker-compose.yml, edit the docker-compose.yml file to replace my jekyll site directory with yours (absolute path preferable):

Edit docker-compose.yml from:

volumes:
    - /home/chief/workspaces/github.com/peteretelej.github.io:/code

To:

volumes:
    - /path/to/your/jekyllsite:/code

Run docker-compose:

docker-compose run --rm jekyll/container

Building your own jekyll image

Build your image

docker build -t YOURNAME/jekyll .

Run your image

cd your-jekyll-app-directory/
docker run --rm -it -p 4000:4000 -v "$PWD":/app -w /app YOURNAME/jekyll

Push your image

docker push YOURNAME/jekyll