-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (38 loc) · 1.36 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.PHONY: image push run debug clean nuke backup restore checkpoint
export DOCKER_REPO ?= jtilander
P4_VERSION ?= 16.2
export TAG ?= test
DATAVOLUMES ?= `pwd`/tmp
DC=docker-compose
DC_FLAGS="-p perforce"
ifeq (run,$(firstword $(MAKECMDGOALS)))
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(RUN_ARGS):;@:)
endif
VOLUMES=-v $(DATAVOLUMES)/metadata:/metadata -v $(DATAVOLUMES)/library:/library -v $(DATAVOLUMES)/journals:/journals -v $(DATAVOLUMES)/backup:/backup
image:
docker build -t $(DOCKER_REPO)/p4d:$(TAG) --build-arg P4_VERSION=$(P4_VERSION) .
docker images $(DOCKER_REPO)/p4d:$(TAG)
push:
docker push $(DOCKER_REPO)/p4d:$(TAG)
run:
docker run --rm $(VOLUMES) -p 1666:1666 $(DOCKER_REPO)/p4d:$(TAG) $(RUN_ARGS)
debug:
docker run --rm -it $(VOLUMES) $(DOCKER_REPO)/p4d:$(TAG) bash
clean:
rm -rf $(DATAVOLUMES) && mkdir $(DATAVOLUMES)
checkpoint:
docker run --rm $(VOLUMES) $(DOCKER_REPO)/p4d:$(TAG) checkpoint
backup:
docker run --rm $(VOLUMES) $(DOCKER_REPO)/p4d:$(TAG) backup
restore:
docker run --rm $(VOLUMES) $(DOCKER_REPO)/p4d:$(TAG) restore checkpoint.gz
nuke: clean
-docker rm -f `docker ps -q -a -f ancestor=$(DOCKER_REPO)/p4d:$(TAG)`
-docker rmi -f `docker images -q -a $(DOCKER_REPO)/p4d:$(TAG)`
up:
$(DC) $(DC_FLAGS) up -d && $(DC) $(DC_FLAGS) logs -f
down:
$(DC) $(DC_FLAGS) down
kill:
$(DC) $(DC_FLAGS) down -v