-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
37 lines (27 loc) · 905 Bytes
/
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
BUILD_IMAGE = hypothesisworks/hypothesisworks.github.io
SERVE_CONTAINER = server
ROOT = $(shell git rev-parse --show-toplevel)
.docker/build: Dockerfile Gemfile Gemfile.lock
docker build --tag $(BUILD_IMAGE) .
mkdir -p .docker
touch .docker/build
build: .docker/build
docker run --volume $(SRC):/site $(BUILD_IMAGE) build
serve: .docker/build
@# Clean up old running containers
@docker stop $(SERVE_CONTAINER) >/dev/null 2>&1 || true
@docker rm $(SERVE_CONTAINER) >/dev/null 2>&1 || true
docker run \
--publish 5858:5858 \
--volume $(ROOT):/site \
--name $(SERVE_CONTAINER) \
--hostname $(SERVE_CONTAINER) \
--tty $(BUILD_IMAGE) \
serve --host $(SERVE_CONTAINER) --port 5858 --watch
Gemfile.lock: Gemfile
docker run \
--volume $(ROOT):/site \
--workdir /site \
--tty $(shell cat Dockerfile | grep FROM | awk '{print $$2}') \
bundle lock --update
.PHONY: build serve