-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
198 lines (163 loc) · 6.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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
JDK_VERS=11.0.1
V16=1.6.0
V17=1.7.0
V18=1.8.0
V19=1.9.0
V110=1.10.0-RC3
BASE_CLJ_VERS=${V19}
ORG=clojusc
BASE_JDK_IMAGE=openjdk:$(JDK_VERS)-jdk-slim-sid
BASE_CLJ_IMAGE=$(ORG)/clojure-$(BASE_CLJ_VERS)-jdk-$(JDK_VERS)
BASE_LEIN_IMAGE=$(ORG)/clojure-$(BASE_CLJ_VERS)-lein-jdk-$(JDK_VERS)
BASE_BOOT_IMAGE=$(ORG)/clojure-$(BASE_CLJ_VERS)-boot-jdk-$(JDK_VERS)
all:
$(MAKE) clj19-all
$(MAKE) clj16-all
$(MAKE) clj17-all
$(MAKE) clj18-all
$(MAKE) clj110-all
publish-all: all clj19-publish clj16-publish clj17-publish clj18-publish clj110-publish
publish:
docker push $(ORG)/clojure-$(CLOJURE_VERSION_LOWER)-jdk-$(JDK_VERS); \
for BUILD_TOOL in lein boot; do \
docker push $(ORG)/clojure-$(CLOJURE_VERSION_LOWER)-$$BUILD_TOOL-jdk-$(JDK_VERS); \
done
clj:
if [ -z "$(BUILD_TOOL)" ]; then \
docker build ./$(CLOJURE_VERSION_LOWER) -t $(ORG)/clojure-$(CLOJURE_VERSION_LOWER)-jdk-$(JDK_VERS); \
else \
docker build ./$(CLOJURE_VERSION_LOWER) -t $(ORG)/clojure-$(CLOJURE_VERSION_LOWER)-$(BUILD_TOOL)-jdk-$(JDK_VERS); \
fi
setup-deps:
mkdir -p $(CLOJURE_VERSION_LOWER)
cp common/Dockerfile common/linux-install-$(BASE_CLJ_VERS).397.sh ./$(CLOJURE_VERSION_LOWER)/
sed 's/CLOJURE_VERSION/$(CLOJURE_VERSION)/g' common/deps.edn > ./$(CLOJURE_VERSION_LOWER)/deps.edn
setup-build-tool:
@echo "Setting up '$(BUILD_TOOL)' build tool ..."
if [ "$(BUILD_TOOL)" = "lein" ]; then \
if [ "$(CLOJURE_VERSION)" = "$(BASE_CLJ_VERS)" ]; then \
echo "FROM $(BASE_CLJ_IMAGE)" > ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
cat common/Dockerfile.lein >> ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
else \
echo "FROM $(BASE_LEIN_IMAGE)" > ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
fi; \
cat common/Dockerfile >> ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
elif [ "$(BUILD_TOOL)" = "boot" ]; then \
if [ "$(CLOJURE_VERSION)" = "$(BASE_CLJ_VERS)" ]; then \
echo "FROM $(BASE_CLJ_IMAGE)" > ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
cat common/Dockerfile.boot >> ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
else \
echo "FROM $(BASE_BOOT_IMAGE)" > ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
fi; \
cat common/Dockerfile >> ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
elif [ "$(CLOJURE_VERSION)" = "$(BASE_CLJ_VERS)" ]; then \
echo "FROM $(BASE_JDK_IMAGE)" > ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
cat common/Dockerfile.deps >> ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
cat common/Dockerfile >> ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
else \
echo "FROM $(BASE_CLJ_IMAGE)" > ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
cat common/Dockerfile >> ./$(CLOJURE_VERSION_LOWER)/Dockerfile; \
fi
setup: setup-deps setup-build-tool
teardown:
rm -rf $(CLOJURE_VERSION_LOWER)
## Versions
clj19-all:
$(MAKE) clj19
$(MAKE) clj19-lein
$(MAKE) clj19-boot
clj16-all:
$(MAKE) clj16
$(MAKE) clj16-lein
$(MAKE) clj16-boot
clj17-all:
$(MAKE) clj17
$(MAKE) clj17-lein
$(MAKE) clj17-boot
clj18-all:
$(MAKE) clj18
$(MAKE) clj18-lein
$(MAKE) clj18-boot
clj110-all:
$(MAKE) clj110
$(MAKE) clj110-lein
$(MAKE) clj110-boot
## Clojure-only
clj19: CLOJURE_VERSION=$(V19)
clj19: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj19: setup clj teardown
clj16: CLOJURE_VERSION=$(V16)
clj16: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj16: setup clj teardown
clj17: CLOJURE_VERSION=$(V17)
clj17: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj17: setup clj teardown
clj18: CLOJURE_VERSION=$(V18)
clj18: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj18: setup clj teardown
clj110: CLOJURE_VERSION=$(V110)
clj110: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj110: setup clj teardown
## With lein
clj19-lein: CLOJURE_VERSION=$(V19)
clj19-lein: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj19-lein: BUILD_TOOL=lein
clj19-lein: clj19
clj16-lein: CLOJURE_VERSION=$(V16)
clj16-lein: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj16-lein: BUILD_TOOL=lein
clj16-lein: clj16
clj17-lein: CLOJURE_VERSION=$(V17)
clj17-lein: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj17-lein: BUILD_TOOL=lein
clj17-lein: clj17
clj18-lein: CLOJURE_VERSION=$(V18)
clj18-lein: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj18-lein: BUILD_TOOL=lein
clj18-lein: clj18
clj110-lein: CLOJURE_VERSION=$(V110)
clj110-lein: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj110-lein: BUILD_TOOL=lein
clj110-lein: clj110
## With boot
clj19-boot: CLOJURE_VERSION=$(V19)
clj19-boot: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj19-boot: BUILD_TOOL=boot
clj19-boot: clj19
clj16-boot: CLOJURE_VERSION=$(V16)
clj16-boot: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj16-boot: BUILD_TOOL=boot
clj16-boot: clj16
clj17-boot: CLOJURE_VERSION=$(V17)
clj17-boot: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj17-boot: BUILD_TOOL=boot
clj17-boot: clj17
clj18-boot: CLOJURE_VERSION=$(V18)
clj18-boot: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj18-boot: BUILD_TOOL=boot
clj18-boot: clj18
clj110-boot: CLOJURE_VERSION=$(V110)
clj110-boot: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj110-boot: BUILD_TOOL=boot
clj110-boot: clj110
## Push to Dockerhub
clj19-publish: CLOJURE_VERSION=$(V19)
clj19-publish: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj19-publish: publish
clj16-publish: CLOJURE_VERSION=$(V16)
clj16-publish: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj16-publish: publish
clj17-publish: CLOJURE_VERSION=$(V17)
clj17-publish: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj17-publish: publish
clj18-publish: CLOJURE_VERSION=$(V18)
clj18-publish: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj18-publish: publish
clj110-publish: CLOJURE_VERSION=$(V110)
clj110-publish: CLOJURE_VERSION_LOWER=$(shell echo $(CLOJURE_VERSION) | tr A-Z a-z)
clj110-publish: publish
.PHONY: setup setup-deps setup-build-tool teardown \
clj clj16 clj17 clj18 clj19 clj110 \
clj16-lein clj17-lein clj18-lein clj19-lein clj110-lein \
clj16-boot clj17-boot clj18-boot clj19-boot clj110-boot \
clj16-all clj17-all clj18-all clj19-all clj110-all