Simple websites with Jekyll and Docker

Josh Habdas

Installing Jekyll

Clone a Jekyll seed


  git clone https://github.com/poole/lanyon.git \
            lanyon && cd $_

Using Mark Otto's Lanyon seed

Add Dockerfile, etc.


  curl -O https://gist.githubusercontent.com/jhabdas/e0d5e3bed0316f1a5783/raw/Dockerfile
  curl -O https://gist.githubusercontent.com/jhabdas/e0d5e3bed0316f1a5783/raw/Gemfile
  curl -O https://gist.githubusercontent.com/jhabdas/e0d5e3bed0316f1a5783/raw/nginx.conf

Grab raw sources, then customize

Get dependencies


  bundle install

Creates the Gemfile.lock referenced in the Dockerfile

Build, run, test


  docker build -t webapp .
  docker run -d -p 80:80 webapp
  curl $(boot2docker ip)

Run site on DigitalOcean

Create Docker Droplet

Create a new user

But in the interest of time...

Upload the site

  
  git add -A && git commit -m "All the things"
  git archive -o app.tar.gz --prefix=app/ master
  scp app.tar.gz root@HOST:

Build and run

  
  ssh root@HOST
  tar zxvf app.tar.gz && docker build -t webapp app/
  docker run -d -p 80:80 webapp

Use -d flag to run daemonized

Confirm site is running

Stopping the site

  
  docker stop $(docker ps -lq)

Resources

Simple websites with Jekyll and Docker

By Josh Habdas

Simple websites with Jekyll and Docker

How to host a simple Jekyll site on Docker with DigitalOcean.

  • 4,332