-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
251 lines (209 loc) · 7.32 KB
/
Makefile
File metadata and controls
251 lines (209 loc) · 7.32 KB
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
ROOT_FOLDER=..
REPOS=\
libs \
webMidiTools \
multisocketServer \
mediaInfoService \
mediaTimelineRenderer \
stageOrchestration \
displayTrigger \
stageViewer \
.PHONY: help
help:
# superLimitBreak system setup
# - build - clone-repos/build docker images
# - push - Push docker images to dockerhub
# - run - Use docker-compose to run from docker images
# - run_local - Use docker-compose to run from local data
# - clean - Delete all repos and docker images
# helpers
# - clone - checkout all repos
# - pull - `git pull` all repos
#
# REPOS="${REPOS}"
# Clone ------------------------------------------------------------------------
.PHONY: clone
clone: \
${ROOT_FOLDER}/libs \
${ROOT_FOLDER}/multisocketServer \
${ROOT_FOLDER}/mediaInfoService \
${ROOT_FOLDER}/mediaTimelineRenderer \
${ROOT_FOLDER}/stageOrchestration \
${ROOT_FOLDER}/stageViewer \
${ROOT_FOLDER}/webMidiTools \
${ROOT_FOLDER}/displayTrigger \
${ROOT_FOLDER}/.dockerignore:
cp .dockerignore ${ROOT_FOLDER}/
# Repos ------------------------------------------------------------------------
libs: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/libs:
cd ${ROOT_FOLDER} ; git clone https://github.com/calaldees/libs.git
mediaInfoService: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/mediaInfoService:
cd ${ROOT_FOLDER} ; git clone https://github.com/superLimitBreak/mediaInfoService.git
mediaTimelineRenderer: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/mediaTimelineRenderer:
cd ${ROOT_FOLDER} ; git clone https://github.com/superLimitBreak/mediaTimelineRenderer.git
multisocketServer: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/multisocketServer:
cd ${ROOT_FOLDER} ; git clone https://github.com/superLimitBreak/multisocketServer.git
stageOrchestration: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/stageOrchestration:
cd ${ROOT_FOLDER} ; git clone https://github.com/superLimitBreak/stageOrchestration.git
displayTrigger: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/displayTrigger:
cd ${ROOT_FOLDER} ; git clone https://github.com/superLimitBreak/displayTrigger.git
stageViewer: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/stageViewer:
cd ${ROOT_FOLDER} ; git clone https://github.com/superLimitBreak/stageViewer.git
webMidiTools: ${ROOT_FOLDER}/$@
ln -s ${ROOT_FOLDER}/$@
${ROOT_FOLDER}/webMidiTools:
cd ${ROOT_FOLDER} ; git clone https://github.com/superLimitBreak/webMidiTools.git
# docker-compose.yml builder ---------------------------------------------------
# Build hybrid docker-compose.yml
# UNFINISHED!
# config_merger.py:
# curl https://raw.githubusercontent.com/calaldees/config-merger/master/config_merger.py -o $@
# DOCKER_COMPOSE_PATHS=displayTrigger/server stageOrchistration stageViewer
# docker-compose.yml: config_merger.py
# for PATH_DOCKER_COMPOSE in ${DOCKER_COMPOSE_PATHS}; do\
# ${ROOT_FOLDER}/$$PATH_DOCKER_COMPOSE ;\
# done
# Build/Push/Pull --------------------------------------------------------------
.PHONY: build
build: clone ${ROOT_FOLDER}/.dockerignore
docker-compose build
docker-compose --file docker-compose.production.yml build displaytrigger
.PHONY: push
push:
docker-compose push
docker-compose --file docker-compose.production.yml push displaytrigger
.PHONY: pull
pull:
docker-compose pull
docker-compose --file docker-compose.production.yml pull displaytrigger
# Manual Build/Push/Pull -------------------------------------------------------
# To be depricated?
DOCKER_BASE_IMAGES=\
alpine \
nginx:alpine \
node:alpine \
python:alpine \
# Annoyingly these imagenames must be in sync with the subrepos - consider a single point of truth
DOCKER_BUILD_VERSION=latest
DOCKER_PACKAGE=superlimitbreak
DOCKER_IMAGE_DISPLAYTRIGGER=${DOCKER_PACKAGE}/displaytrigger:${DOCKER_BUILD_VERSION}
DOCKER_IMAGE_DISPLAYTRIGGER_PRODUCTION=${DOCKER_PACKAGE}/displaytrigger:production
DOCKER_IMAGE_MEDIAINFOSERVICE=${DOCKER_PACKAGE}/mediainfoservice:${DOCKER_BUILD_VERSION}
DOCKER_IMAGE_MEDIATIMELINERENDERER=${DOCKER_PACKAGE}/mediatimelinerenderer:${DOCKER_BUILD_VERSION}
DOCKER_IMAGE_SUBSCRIPTIONSERVER=${DOCKER_PACKAGE}/subscriptionserver2:${DOCKER_BUILD_VERSION}
DOCKER_IMAGE_STAGEORCHESTRATION=${DOCKER_PACKAGE}/stageorchestration:${DOCKER_BUILD_VERSION}
DOCKER_IMAGES=\
${DOCKER_IMAGE_SUBSCRIPTIONSERVER} \
${DOCKER_IMAGE_MEDIAINFOSERVICE} \
${DOCKER_IMAGE_MEDIATIMELINERENDERER} \
${DOCKER_IMAGE_STAGEORCHESTRATION} \
${DOCKER_IMAGE_DISPLAYTRIGGER} \
${DOCKER_IMAGE_DISPLAYTRIGGER_PRODUCTION} \
_build_manual: clone ${ROOT_FOLDER}/.dockerignore
${MAKE} build --directory ${ROOT_FOLDER}/mediaInfoService
${MAKE} build --directory ${ROOT_FOLDER}/mediaTimelineRenderer
${MAKE} build --directory ${ROOT_FOLDER}/multisocketServer
${MAKE} build --directory ${ROOT_FOLDER}/stageOrchestration
docker build \
-t ${DOCKER_IMAGE_DISPLAYTRIGGER} \
--file Dockerfile \
${ROOT_FOLDER}
docker build \
-t ${DOCKER_IMAGE_DISPLAYTRIGGER_PRODUCTION} \
--file Dockerfile.production \
--build-arg DISPLAYTRIGGER_IMAGENAME=${DOCKER_IMAGE_DISPLAYTRIGGER} \
./
#build: clone ${ROOT_FOLDER}/.dockerignore
# docker-compose build --file docker-compose.yml --file docker-compose.build.yml
#push:
# docker-compose push --file docker-compose.yml --file docker-compose.build.yml
_push_manual:
# TODO: call sub Makefiles?
for DOCKER_IMAGE in ${DOCKER_IMAGES}; do\
docker push $$DOCKER_IMAGE ;\
done
_pull_manual_base:
for DOCKER_BASE_IMAGE in ${DOCKER_BASE_IMAGES}; do\
docker pull $$DOCKER_BASE_IMAGE ;\
done
_clean_manual:
for DOCKER_IMAGE in ${DOCKER_IMAGES}; do\
docker rmi $$DOCKER_IMAGE ;\
done
# Pull Repos -------------------------------------------------------------------
.PHONY: pull_repos
pull_repos: clone
for REPO in ${REPOS}; do\
echo "Pulling $$REPO" ;\
cd ${ROOT_FOLDER}/$$REPO ; git pull ;\
done
# Run --------------------------------------------------------------------------
.PHONY: run
run:
docker-compose up
.PHONY: run_local
run_local:
docker-compose \
--file docker-compose.yml \
--file docker-compose.local.yml \
up \
--abort-on-container-exit \
# Run bare displaytrigger/multisocketserver without other containers
# often used when developing stageOrcheatration locally
.PHONY: run_displaytrigger_local
run_displaytrigger_local:
docker-compose \
--file docker-compose.yml \
--file docker-compose.local.yml \
up \
--abort-on-container-exit \
displaytrigger \
subscriptionserver \
mediainfoservice
#--exit-code-from displaytrigger \
#displaytrigger
.PHONY: run_production
run_production:
docker-compose \
--file docker-compose.production.yml \
up
.PHONY: run_production_local
run_production_local:
STAGEORCHESTRATION_timeoffset_media_seconds='0.00' \
docker-compose \
--file docker-compose.production.yml \
--file docker-compose.local.yml \
up \
--abort-on-container-exit
# Cloc -------------------------------------------------------------------------
.PHONY: cloc
cloc:
for REPO in ${REPOS}; do\
echo "$$REPO" ;\
${MAKE} cloc --directory ${ROOT_FOLDER}/$$REPO ;\
done
# Clean ------------------------------------------------------------------------
.PHONY: clean_repos
clean_repos:
for REPO in ${REPOS}; do\
rm -rf ${ROOT_FOLDER}/$$REPO ;\
done
.PHONY: clean
clean:
for REPO in ${REPOS}; do\
${MAKE} clean --directory $$REPO ;\
done