Skip to content

Commit

Permalink
Add support for previewing locally (#49)
Browse files Browse the repository at this point in the history
Uses docker-compose to pull down pages-ready jekyll from Docker Hub.

Also lays down a Makefile with targets to lifecycle manage
docker-compose resources.

This lets you preview changes pre-commit so you dont commit 🚮!
  • Loading branch information
filler authored and JJ Asghar committed Sep 27, 2016
1 parent 4a03429 commit 71c6729
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.PHONY: all fire-up fire-down
.SILENT: banner help

SHELL := /bin/bash
DOCKERCOMPOSE:= $(shell command -v docker-compose 2> /dev/null)

default: help

banner:
echo ""
echo " _ _ ___ _ "
echo " | |_ |_| ___ ___ | _| |_| ___ ___ "
echo " | _| | | | _| | -_| | _| | | _ | _| | -_|"
echo " |_| |_| |_| |___| |_| |_| |_| |_| |___|"
echo ""

help: banner
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

preflight:
ifndef DOCKERCOMPOSE
$(error "docker-compose not found in PATH - is it installed?")
endif

fire-up: preflight ## Run docker-compose up -d
@docker-compose up -d && \
sleep 30 && \
open "http://0.0.0.0:4000/"

fire-ps: preflight ## Run docker-compose down
@docker-compose ps

fire-down: preflight ## Run docker-compose down
@docker-compose down

fire-rm: preflight ## Run docker-compose rm
@docker-compose rm --force
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tirefire:
image: jekyll/jekyll:pages
command: bundle exec jekyll serve
ports:
- 4000:4000
volumes:
- .:/srv/jekyll

0 comments on commit 71c6729

Please sign in to comment.