-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
61 lines (46 loc) · 1.21 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
# Makefile
#
# build
#
-include *.mk
BLD_ARG ?= --build-arg DIST=nginx --build-arg REL=alpine
BLD_REPO ?= mlan/gitweb
BLD_VER ?= latest
BLD_TGT ?= full
BLD_TGTS ?= base full
BLD_CMT ?= HEAD
BLD_DNLD ?= curl -o
TST_REPO ?= $(BLD_REPO)
TST_VER ?= $(BLD_VER)
TST_ENV ?= -C test
TST_TGTE ?= $(addprefix test-,all diff down env logs sh up)
TST_INDX ?= 1 2
TST_TGTI ?= $(addprefix test_,$(TST_INDX)) $(addprefix test-up_,$(TST_INDX))
export TST_REPO TST_VER
push:
#
# PLEASE REVIEW THESE IMAGES WHICH ARE ABOUT TO BE PUSHED TO THE REGISTRY
#
@docker image ls $(BLD_REPO)
#
# ARE YOU SURE YOU WANT TO PUSH THESE IMAGES TO THE REGISTRY? [yN]
@read input; [ "$${input}" = "y" ]
docker push --all-tags $(BLD_REPO)
build-all: $(addprefix build_,$(BLD_TGTS))
build: build_$(BLD_TGT)
build_%: pre_build
docker build $(BLD_ARG) --target $* \
$(addprefix --tag $(BLD_REPO):,$(call bld_tags,$*,$(BLD_VER))) .
pre_build: Dockerfile
variables:
make -pn | grep -A1 "^# makefile"| grep -v "^#\|^--" | sort | uniq
ps:
docker ps -a
prune:
docker image prune -f
clean:
docker images | grep $(BLD_REPO) | awk '{print $$1 ":" $$2}' | uniq | xargs docker rmi
$(TST_TGTE):
${MAKE} $(TST_ENV) $@
$(TST_TGTI):
${MAKE} $(TST_ENV) $@