-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
39 lines (30 loc) · 1.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
IMAGE := jekyll-image-agude
MOUNT := /workspace
.PHONY: all clean serve drafts debug image refresh
all: serve
# Clean out _site and other caches
clean: image
docker run --rm -p 4000:4000 -v $(PWD):$(MOUNT) -w $(MOUNT) $(IMAGE) bundle exec jekyll clean
# Serve the site as it will appear when published.
serve: image clean
docker run --rm -p 4000:4000 -p 35729:35729 -v $(PWD):$(MOUNT) -w $(MOUNT) $(IMAGE) bundle exec jekyll serve --watch --safe --incremental --livereload
# Serve the site but also publish drafts.
drafts: image clean
docker run --rm -p 4000:4000 -p 35729:35729 -v $(PWD):$(MOUNT) -w $(MOUNT) $(IMAGE) bundle exec jekyll serve --drafts --future --watch --safe --incremental --livereload
# Interactive session within the image so you can poke around.
debug: image
docker run -it --rm -p 4000:4000 -v $(PWD):$(MOUNT) -w $(MOUNT) $(IMAGE)
# Don't send the whole repo to Docker. All we need is the Gemfile.
BUILDDIR := /tmp/jekyll-docker-agude
image: Dockerfile Gemfile
rm -rf $(BUILDDIR)
mkdir -p $(BUILDDIR)
cp Gemfile $(BUILDDIR)
docker build $(BUILDDIR) -f Dockerfile -t $(IMAGE)
# Rebuilding from halfway using a cached image can sometimes cause
# problems. Use `make refresh` to rebuild the image from the ground up.
refresh: Dockerfile Gemfile
rm -rf $(BUILDDIR)
mkdir -p $(BUILDDIR)
cp Gemfile $(BUILDDIR)
docker build $(BUILDDIR) -f Dockerfile -t $(IMAGE) --no-cache