1- FROM node:20.11.1 AS build-service
1+ FROM node:18
22
3- WORKDIR /service
4- COPY service/package*.json ./
5- RUN npm install
6- COPY service/ ./
7- RUN npm run build
3+ LABEL author="NGA"
84
9- RUN npm pack
5+ USER root
106
11- # Build web-app
12- FROM node:20.11.1 AS build-webapp
7+ RUN apt-get update
138
14- WORKDIR /web-app
15- COPY web-app/package*.json ./
16- RUN npm install
17- COPY web-app/ ./
18- RUN npm run build
9+ RUN groupadd -r mage \
10+ && useradd -m -r -s /bin/bash -g mage mage \
11+ && mkdir -p /var/lib/mage \
12+ && chown mage:mage /var/lib/mage
1913
20- RUN npm pack ./dist
14+ USER mage
15+ ENV MAGE_HOME=/home/mage/instance
16+ WORKDIR ${MAGE_HOME}
17+ RUN npm install @ngageoint/
[email protected] 18+ RUN npm install @ngageoint/
[email protected] 19+ RUN ln -s ./node_modules/.bin/mage.service
2120
22- FROM node:20.11.1 AS build-arcwebplugin
23- # Build arcgis service plugin
24- WORKDIR /arcgiswebplugin
25- COPY plugins/arcgis/web-app/package*.json ./
26- RUN npm install
27- COPY --from=build-service /service /arcgiswebplugin/node_modules/@ngageoint/mage.service
28- COPY --from=build-service /service /arcgiswebplugin/node_modules/@ngageoint/mage.service
29- COPY plugins/arcgis/web-app/ ./
30- RUN npm run build
31- RUN npm pack ./dist/main
21+ VOLUME /var/lib/mage
22+ EXPOSE 4242
3223
33- FROM node:20.11.1 AS build-arcserviceplugin
34- WORKDIR /arcgisserviceplugin
35- COPY plugins/arcgis/service/package*.json ./
36- RUN npm install
37- COPY --from=build-service /service /arcgisserviceplugin/node_modules/@ngageoint/mage.service
38- COPY plugins/arcgis/service/ ./
39- RUN npm run build
40- RUN npm pack
41-
42- # FROM node:20.11.1 AS build-imageserviceplugin
43- # WORKDIR /imageserviceplugin
44- # COPY plugins/image/service/package*.json ./
45- # RUN npm install
46- # COPY --from=build-service /service /imageserviceplugin/node_modules/@ngageoint/mage.service
47- # RUN rm -rf /imageserviceplugin/node_modules/@ngageoint/mage.service/node_modules/mongoose
48- # COPY plugins/image/service/ ./
49- # RUN npm run build
50- # RUN npm pack
51-
52- FROM node:20.11.1 AS build-sftpserviceplugin
53- WORKDIR /sftpserviceplugin
54- COPY plugins/sftp/service/package*.json ./
55- RUN npm install
56- COPY --from=build-service /service /sftpserviceplugin/node_modules/@ngageoint/mage.service
57- COPY plugins/sftp/service/ ./
58- COPY --from=build-service /service /sftpserviceplugin/node_modules/@ngageoint/mage.service
59- COPY plugins/sftp/service/ ./
60- RUN npm run build
61- RUN npm pack
62-
63- FROM node:20.11.1 AS build-sftpwebplugin
64- # Build sftp service plugin
65- WORKDIR /sftpwebplugin
66- COPY plugins/sftp/web/package*.json ./
67- RUN npm install
68- COPY plugins/sftp/web/ ./
69- RUN npm run build
70- RUN npm pack ./dist/main
71-
72- # Build instance
73- FROM node:20.11.1 AS build-instance
74- COPY --from=build-service /service/ngageoint*.tgz /service/
75- COPY --from=build-webapp /web-app/ngageoint*.tgz /web-app/
76- COPY --from=build-arcwebplugin /arcgiswebplugin/ngageoint*.tgz /arcgiswebplugin/
77- COPY --from=build-arcserviceplugin /arcgisserviceplugin/ngageoint*.tgz /arcgisserviceplugin/
78- COPY --from=build-sftpserviceplugin /sftpserviceplugin/ngageoint*.tgz /sftpserviceplugin/
79- COPY --from=build-sftpwebplugin /sftpwebplugin/ngageoint*.tgz /sftpwebplugin/
80-
81- WORKDIR /instance
82- RUN ls -la ../sftpwebplugin
83- RUN npm install ../service/ngageoint-mage.service*.tgz
84- RUN npm install ../web-app/ngageoint-mage.web-app*.tgz
85- RUN npm install ../sftpwebplugin/ngageoint-mage.sftp.web*.tgz
86- RUN npm install ../sftpserviceplugin/ngageoint-mage.sftp.service*.tgz
87- RUN npm install ../arcgiswebplugin/ngageoint*.tgz
88- RUN npm install ../arcgisserviceplugin/ngageoint*.tgz
89-
90-
91- ENV NODE_PATH=./node_modules
92- ENTRYPOINT [ \
93- "./node_modules/.bin/mage.service" , \
94- "--plugin" , "@ngageoint/mage.image.service" , \
95- "--plugin" , "@ngageoint/mage.arcgis.service" , \
96- "--plugin" , "@ngageoint/mage.sftp.service" , \
97- "--web-plugin" , "@ngageoint/mage.sftp.web" , \
98- "--plugin" , "@ngageoint/mage.sftp.service" , \
99- "--web-plugin" , "@ngageoint/mage.sftp.web" , \
100- "--web-plugin" , "@ngageoint/mage.arcgis.web-app" \
101- ]
24+ ENTRYPOINT [ "./mage.service" ]
0 commit comments