• Stars
    star
    336
  • Rank 125,564 (Top 3 %)
  • Language
    Dockerfile
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Jekyll in a Docker Container For Easy SSG Development

Jekyll in a Docker Container

GitHub Super-Linter Docker Build

But this has been done. Why not docker run jekyll/jekyll?

  • I wanted two images, one for easy CLI (bretfisher/jekyll) and one for easy local server for dev with sane defaults (bretfisher/jekyll-serve), which I use 90% of the time
  • So you can start any Jekyll server with docker-compose up
  • I wanted to dev on a local Jekyll site without having Jekyll installed on my host OS
  • I wanted it to be as easy as possible to start
  • I wanted current amd64 and arm64 images using official Ruby and Jekyll latest

So, this does that.

Note I have courses on Docker (including a Lecture on Jekyll in Docker).

‼️ ‼️ ‼️

⚠️ WARNING: ⚠️ This isn't meant to be a production image that you run a web server with. I don't do that with the Jekyll CLI that comes with this image. Jekyll CLI generates a static site that you can run with GitHub Pages, Netlify, or your own NGINX setup. Furthermore, I don't version anything so these images will not run guaranteed versions of Ruby, Jekyll, etc. (which, if you're running a server, should pin all versions usually.)

Docker Images

Image Purpose Example
bretfisher/jekyll Runs Jekyll by default with no options, good for general CLI commands docker run -v $(pwd):/site bretfisher/jekyll new .
bretfisher/jekyll-serve Runs Jekyll serve with sane defaults, good for local Jekyll site dev docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve

Getting Started

Creating a site:

cd to empty directory
docker run -v $(pwd):/site bretfisher/jekyll new .

Start a local server with sane defaults listening on port 4000:

cd dir/of/your/jekyll/site
docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve

That's it!

Details: it will mount your current path into the containers /site, bundle install before running jekyll serve to , serve it at http://<docker-host>:4000.

To make this even easier, copy docker-compose.yml from this repository to your jekyll site root. Then you'll only need to:

cd dir/of/your/jekyll/site
docker-compose up

Known issues

  1. arm/v7 version (aka armhf) doesn't exist in this repository.
    • Yes, arm/v7 has become too difficult to support.
  2. alpine version doesn't exist in this repository.
    • Yes, not all Jekyll dependencies are built with musl support, so glibc-based images are now the only option (Debian, Ubuntu, etc).
  3. RESOLVED as of Jekyll 4.3 webrick errors during startup.
    • As of April 2021, Ruby 3.0 is out, and Jekyll is still on 4.2 (released 12/2020). Jekyll 4.2 doesn't have webrick listed as a dependency, so we'll have to manually add it to Gemfile for now if you want to use Ruby 3.0. Ruby 3.0 removed this bundled gems so you'll need to add them manually if you use them: sdbm, webrick, net-telnet, xmlrpc. Hopefully Jekyll 4.3 will have webrick listed as a Jekyll dependency (it is fixed in Jekyll master branch) so manually updating Gemfiles won't be needed.

Q&A

Q. What if I want to run other jekyll commands?

just add the jekyll options to the end of the bretfisher/jekyll:

docker run -v $(pwd):/site bretfisher/jekyll doctor

Q. What if I want to build a site with Gemfile dependencies?

As your Jekyll site gets fancier, you'll need to add Jekyll plugins via Ruby's Gemfile and bundle CLI. You'll need to do a bundle install first before building your Jekyll site.

If you were using this repo's image, you could:

docker run -v $(pwd):/site -it --entrypoint bash bretfisher/jekyll

Then run your commands interactively:

bundle install --retry 5 --jobs 20
bundle exec jekyll build

Then your bind-mounted _site will be there on your host, built by Jekyll using your Gemfile Jekyll dependencies that were installed in that container.

If this is something you do often, you'll want to build your own image that already has your Ruby dependencies installed. Then when you run the jekyll build command, it'll have all the Gemfile dependencies it needs.

License

MIT License

Copyright (c) [Bret Fisher [email protected]]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

udemy-docker-mastery

Docker Mastery Udemy course to build, compose, deploy, and manage containers from local development to high-availability in the cloud
JavaScript
5,263
star
2

node-docker-good-defaults

sample node app for Docker examples
JavaScript
2,323
star
3

dogvscat

Sample Docker Swarm cluster stack of tools
HCL
504
star
4

nodejs-rocks-in-docker

DockerCon "Docker for Node.js" examples
Dockerfile
494
star
5

docker-mastery-for-nodejs

Docker Mastery for Node.js Projects, From a Docker Captain
JavaScript
412
star
6

awesome-swarm

All the awesome tools, docs, and training on Docker and Mirantis Swarm Mode (SwarmKit)
385
star
7

php-docker-good-defaults

*WORK IN PROGRESS* sample PHP/Laravel app for Docker examples
Dockerfile
362
star
8

docker-vackup

Script to easily backup and restore docker volumes
Shell
362
star
9

docker-ci-automation

GitHub Actions automation examples with Docker's official actions
Shell
247
star
10

kubernetes-mastery

Kubernetes course on Udemy from @BretFisher and @jpetazzo
Shell
233
star
11

multi-platform-docker-build

Using BuildKit and TARGETPLATFORM for cross-platform Dockerfiles
Dockerfile
125
star
12

compose-dev-tls

Easy Traefik TLS proxy plus certificate generation for Docker Compose local development use
Shell
111
star
13

github-actions-templates

Reusable GitHub Actions workflow examples for cloud native DevOps
Dockerfile
75
star
14

podspec

Kubernetes Pod Specification Good Defaults
71
star
15

browncoat

Container for testing app failures in orchestrators. It aims to misbehave.
JavaScript
69
star
16

httping-docker

Ping with HTTP requests, built directly from master
C
52
star
17

docker-build-workflow

A Reusable Workflow of the Docker GitHub Actions
Dockerfile
42
star
18

super-linter-workflow

A Reusable Workflow of the Super-Linter GitHub Action
37
star
19

gha-runners

Terraform to create GitHub Action self-hosted runners in EC2 using ASG
HCL
29
star
20

slack-signup

Slack Team Access Request Form in Meteor
JavaScript
27
star
21

container-security-steps

Docker and Kubernetes security steps to help you create, build, test, and run safer in containers
26
star
22

stress

Docker images for stressing cpu and memory
Dockerfile
25
star
23

sysbench-docker-hpe

Sysbench Dockerfiles and Scripts for VM and Container benchmarking MySQL
Shell
19
star
24

BretFisher

18
star
25

petclinic

sample dockerization of a Java Spring Boot app
Java
17
star
26

redis-tini

Docker image of official redis with tini added for liveness healthchecks that reap zombies
Dockerfile
17
star
27

nodemongoapp

Docker Example Node + Mongo App
JavaScript
11
star
28

initcontainers

Kubernetes initContainers examples and good defaults
10
star
29

bret.run

Static files for easy gettin' stuff
Shell
7
star
30

PowerShell-Profile

Microsoft.PowerShell_profile.ps1
PowerShell
7
star
31

resume

My Resume, hopefully current.
HTML
5
star
32

gitops-argocd

4
star
33

completion-image

Generates completion certificates (images) for students based on a template image and a CSV file containing student names.
Go
3
star
34

wordsmith-k8s

Manifests for Docker's wordsmith demo
3
star
35

cheese

Simple web servers of cheese for yummy demos.
HTML
3
star
36

docker-github-actions-monorepo-example

3
star
37

slide-to-image

JavaScript
1
star
38

.github

1
star
39

dotfiles

My public dotfiles for Codespaces and examples
Shell
1
star
40

gatsby-starter-netlify-cms

JavaScript
1
star
41

nodeBeginnerBookLearnings

Me just learning the node code from the Excellent
1
star
42

AutoSPInstaller-User-Creator

I use this PowerShell Script with www.autospinstaller.com to automate (most) of a SharePoint 2010 deployment
PowerShell
1
star
43

katacoda-scenarios

https://www.katacoda.com/bretfisher
1
star
44

pmx-docker

Shell
1
star