-
Notifications
You must be signed in to change notification settings - Fork 60
/
Makefile
65 lines (46 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.PHONY: image clean push
all: image
-include local.mk
P4_VERSION ?= 19.1
P4_BASEIMAGE ?= centos@sha256:a799dd8a2ded4a83484bbae769d97655392b3f86533ceb7dd96bbac929809f3c
DOCKER_REPO ?= ambakshi
IMAGES=perforce-base perforce-proxy perforce-server perforce-git-fusion \
perforce-swarm perforce-sampledepot perforce-p4web
DOCKER_BUILD_ARGS ?= --build-arg P4_BASEIMAGE=$(P4_BASEIMAGE) --build-arg http_proxy=$(http_proxy) --build-arg P4_VERSION=$(P4_VERSION)
NOCACHE ?= 0
ifeq "$(NOCACHE)" '1'
DOCKER_BUILD_ARGS += --no-cache
endif
.PHONY: $(IMAGES)
# Include local settings (like http_proxy)
-include local.mk
perforce-proxy: perforce-base
perforce-server: perforce-base
perforce-proxy: perforce-base
perforce-git-fusion: perforce-server
perforce-sampledepot: perforce-server
perforce-swarm: perforce-base
perforce-p4web: perforce-base
rebuild:
$(MAKE) clean
docker pull centos:7
$(MAKE) NOCACHE=1
%/id_rsa.pub: id_rsa.pub
cp $< $@
id_rsa:
ssh-keygen -q -f $@ -N ""
id_rsa.pub: id_rsa
ssh-keygen -y -f $< > $@
define DOCKER_build
.PHONY: $(1) $(1)-clean
image: $(1)
clean: $(1)-clean
$(1): $(1)/Dockerfile
@echo "===================="
@echo "Building $(DOCKER_REPO)/$(1) ..."
docker build $$(DOCKER_BUILD_ARGS) -t $(1) $(1)
docker tag $(1) $(DOCKER_REPO)/$(1)
$(1)-clean:
-docker rmi $(DOCKER_REPO)/$(1) 2>/dev/null
endef
$(foreach image,$(IMAGES),$(eval $(call DOCKER_build,$(image))))