-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
88 lines (75 loc) · 3.84 KB
/
Dockerfile
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
# Pre-requestits
# Context should contain hard folders for
# libs
# displayTrigger
# stageViewer
# webMidiTools
# Reference
# https://medium.com/@tonistiigi/advanced-multi-stage-build-patterns-6f741b852fae
FROM node:alpine as base
RUN apk add --no-cache git python3 make
# https://github.com/moby/moby/issues/37345#issuecomment-400250849
ARG PATH_BUILD_TRIGGER=build/displayTrigger/trigger
ENV PATH_BUILD_TRIGGER=${PATH_BUILD_TRIGGER}
ARG PATH_BUILD_DISPLAY=build/displayTrigger/display
ENV PATH_BUILD_DISPLAY=${PATH_BUILD_DISPLAY}
ARG PATH_BUILD_STAGEVIEWER=build/stageViewer
ENV PATH_BUILD_STAGEVIEWER=${PATH_BUILD_STAGEVIEWER}
FROM node:alpine as build
COPY multisocketServer/package.json build/multisocketServer/package.json
COPY multisocketServer/clients/ build/multisocketServer/clients/
COPY libs/package.json build/libs/package.json
COPY libs/es6/ build/libs/es6/
FROM base as base_display
COPY displayTrigger/display/package.json ${PATH_BUILD_DISPLAY}/package.json
RUN npm install --prefix=${PATH_BUILD_DISPLAY} && npm cache clean --prefix=${PATH_BUILD_DISPLAY} --force
COPY --from=build build build
RUN npm link build/multisocketServer/ --prefix=${PATH_BUILD_DISPLAY}
RUN npm link build/libs/ --prefix=${PATH_BUILD_DISPLAY}
FROM base as base_trigger
COPY displayTrigger/trigger/package.json ${PATH_BUILD_TRIGGER}/package.json
RUN npm install --prefix=${PATH_BUILD_TRIGGER} && npm cache clean --prefix=${PATH_BUILD_TRIGGER} --force
COPY --from=build build build
RUN npm link build/multisocketServer/ --prefix=${PATH_BUILD_TRIGGER}
RUN npm link build/libs/ --prefix=${PATH_BUILD_TRIGGER}
FROM base as base_stageViewer
COPY stageViewer/package.json ${PATH_BUILD_STAGEVIEWER}/package.json
RUN npm install --prefix=${PATH_BUILD_STAGEVIEWER} && npm cache clean --prefix=${PATH_BUILD_STAGEVIEWER} --force
COPY --from=build build build
RUN npm link build/multisocketServer/ --prefix=${PATH_BUILD_STAGEVIEWER}
RUN npm link build/libs/ --prefix=${PATH_BUILD_STAGEVIEWER}
FROM base_display as display
COPY displayTrigger/display/ ${PATH_BUILD_DISPLAY}
RUN npm run build --prefix=${PATH_BUILD_DISPLAY}
FROM base_trigger as trigger
COPY displayTrigger/trigger/ ${PATH_BUILD_TRIGGER}
COPY \
displayTrigger/display/.babelrc \
displayTrigger/display/.editorconfig \
displayTrigger/display/.eslintrc \
displayTrigger/display/webpack.config.base.js \
${PATH_BUILD_TRIGGER}/
RUN npm run build --prefix=${PATH_BUILD_TRIGGER}
FROM base_stageViewer as stageViewer
# humm .. can we not just copy display/static/?
COPY --from=display ${PATH_BUILD_DISPLAY} ${PATH_BUILD_DISPLAY}
#RUN rm -rf ${PATH_BUILD_DISPLAY}/node_modules
#RUN npm link ${PATH_BUILD_DISPLAY} --prefix=${PATH_BUILD_STAGEVIEWER}
RUN \
ln -s /${PATH_BUILD_DISPLAY} /${PATH_BUILD_STAGEVIEWER}/lib/node_modules/displayTrigger &&\
ln -s ../lib/node_modules/displayTrigger /${PATH_BUILD_STAGEVIEWER}/node_modules/displayTrigger
COPY stageViewer/ ${PATH_BUILD_STAGEVIEWER}
RUN npm run build --prefix=${PATH_BUILD_STAGEVIEWER}
#---
FROM nginx:alpine
ARG PATH_BUILD_SRV=srv
RUN DIR=${PATH_BUILD_SRV}/eventmap/ && mkdir -p ${DIR} && echo "${DIR} should be mounted here" >> ${DIR}/readme.txt
RUN DIR=${PATH_BUILD_SRV}/media/ && mkdir -p ${DIR} && echo "${DIR} should be mounted here" >> ${DIR}/readme.txt
COPY displayTrigger/server/nginx.conf /etc/nginx/nginx.conf
COPY displayTrigger/server/root ${PATH_BUILD_SRV}/root
COPY displayTrigger/displayconfig ${PATH_BUILD_SRV}/displayconfig
COPY stageViewer/stageconfig ${PATH_BUILD_SRV}/stageconfig
COPY webMidiTools ${PATH_BUILD_SRV}/webMidiTools
COPY --from=trigger build/displayTrigger/trigger/static/ ${PATH_BUILD_SRV}/trigger/
COPY --from=display build/displayTrigger/display/static/ ${PATH_BUILD_SRV}/display/
COPY --from=stageViewer build/stageViewer/static/ ${PATH_BUILD_SRV}/stageViewer/