forked from phusion/passenger-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
133 lines (118 loc) · 5.55 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
NAME = phusion/passenger
VERSION = 0.9.18
.PHONY: all build_all \
build_customizable \
build_ruby19 build_ruby20 build_ruby21 build_ruby22 build_jruby90 \
build_nodejs build_full \
tag_latest release clean clean_images
all: build_all
build_all: \
build_customizable \
build_ruby19 \
build_ruby20 \
build_ruby21 \
build_ruby22 \
build_jruby90 \
build_nodejs \
build_full
# Docker doesn't support sharing files between different Dockerfiles. -_-
# So we copy things around.
build_customizable:
rm -rf customizable_image
cp -pR image customizable_image
docker build -t $(NAME)-customizable:$(VERSION) --rm customizable_image
build_ruby19:
rm -rf ruby19_image
cp -pR image ruby19_image
echo ruby19=1 >> ruby19_image/buildconfig
echo final=1 >> ruby19_image/buildconfig
docker build -t $(NAME)-ruby19:$(VERSION) --rm ruby19_image
build_ruby20:
rm -rf ruby20_image
cp -pR image ruby20_image
echo ruby20=1 >> ruby20_image/buildconfig
echo final=1 >> ruby20_image/buildconfig
docker build -t $(NAME)-ruby20:$(VERSION) --rm ruby20_image
build_ruby21:
rm -rf ruby21_image
cp -pR image ruby21_image
echo ruby21=1 >> ruby21_image/buildconfig
echo final=1 >> ruby21_image/buildconfig
docker build -t $(NAME)-ruby21:$(VERSION) --rm ruby21_image
build_ruby22:
rm -rf ruby22_image
cp -pR image ruby22_image
echo ruby22=1 >> ruby22_image/buildconfig
echo final=1 >> ruby22_image/buildconfig
docker build -t $(NAME)-ruby22:$(VERSION) --rm ruby22_image
build_jruby90:
rm -rf jruby90_image
cp -pR image jruby90_image
echo jruby90=1 >> jruby90_image/buildconfig
echo final=1 >> jruby90_image/buildconfig
docker build -t $(NAME)-jruby90:$(VERSION) --rm jruby90_image
build_nodejs:
rm -rf nodejs_image
cp -pR image nodejs_image
echo nodejs=1 >> nodejs_image/buildconfig
echo final=1 >> nodejs_image/buildconfig
docker build -t $(NAME)-nodejs:$(VERSION) --rm nodejs_image
build_full:
rm -rf full_image
cp -pR image full_image
echo ruby19=1 >> full_image/buildconfig
echo ruby20=1 >> full_image/buildconfig
echo ruby21=1 >> full_image/buildconfig
echo ruby22=1 >> full_image/buildconfig
echo jruby90=1 >> full_image/buildconfig
echo python=1 >> full_image/buildconfig
echo nodejs=1 >> full_image/buildconfig
echo redis=1 >> full_image/buildconfig
echo memcached=1 >> full_image/buildconfig
echo final=1 >> full_image/buildconfig
docker build -t $(NAME)-full:$(VERSION) --rm full_image
tag_latest:
docker tag -f $(NAME)-customizable:$(VERSION) $(NAME)-customizable:latest
docker tag -f $(NAME)-ruby19:$(VERSION) $(NAME)-ruby19:latest
docker tag -f $(NAME)-ruby20:$(VERSION) $(NAME)-ruby20:latest
docker tag -f $(NAME)-ruby21:$(VERSION) $(NAME)-ruby21:latest
docker tag -f $(NAME)-ruby22:$(VERSION) $(NAME)-ruby22:latest
docker tag -f $(NAME)-jruby90:$(VERSION) $(NAME)-jruby90:latest
docker tag -f $(NAME)-nodejs:$(VERSION) $(NAME)-nodejs:latest
docker tag -f $(NAME)-full:$(VERSION) $(NAME)-full:latest
release: tag_latest
@if ! docker images $(NAME)-customizable | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-customizable version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! docker images $(NAME)-ruby19 | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-ruby19 version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! docker images $(NAME)-ruby20 | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-ruby20 version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! docker images $(NAME)-ruby21 | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-ruby21 version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! docker images $(NAME)-ruby22 | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-ruby22 version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! docker images $(NAME)-jruby90 | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-jruby90 version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! docker images $(NAME)-nodejs | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-nodejs version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! docker images $(NAME)-full | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)-full version $(VERSION) is not yet built. Please run 'make build'"; false; fi
docker push $(NAME)-customizable
docker push $(NAME)-ruby19
docker push $(NAME)-ruby20
docker push $(NAME)-ruby21
docker push $(NAME)-ruby22
docker push $(NAME)-jruby90
docker push $(NAME)-nodejs
docker push $(NAME)-full
@echo "*** Don't forget to create a tag. git tag rel-$(VERSION) && git push origin rel-$(VERSION)"
clean:
rm -rf customizable_image
rm -rf ruby19_image
rm -rf ruby20_image
rm -rf ruby21_image
rm -rf ruby22_image
rm -rf jruby90_image
rm -rf nodejs_image
rm -rf full_image
clean_images:
docker rmi phusion/passenger-customizable:latest phusion/passenger-customizable:$(VERSION) || true
docker rmi phusion/passenger-ruby19:latest phusion/passenger-ruby19:$(VERSION) || true
docker rmi phusion/passenger-ruby20:latest phusion/passenger-ruby20:$(VERSION) || true
docker rmi phusion/passenger-ruby21:latest phusion/passenger-ruby21:$(VERSION) || true
docker rmi phusion/passenger-ruby22:latest phusion/passenger-ruby22:$(VERSION) || true
docker rmi phusion/passenger-jruby90:latest phusion/passenger-jruby90:$(VERSION) || true
docker rmi phusion/passenger-nodejs:latest phusion/passenger-nodejs:$(VERSION) || true
docker rmi phusion/passenger-full:latest phusion/passenger-full:$(VERSION) || true