use meshcentral files from local repository instead of the npm module

Simon Schön committed Jun 6, 2022 at 19:39 UTC 118044bcf307c272237c887669ae87dcc215b5db
3 files changed +36 -15
.dockerignore new
+9
@@ -0,0 +1,9 @@
1 +.github/
2 +.vscode/
3 +docs/
4 +.gitignore
5 +.gitlab-ci.yml
6 +*.bat
7 +*.sln
8 +*.njsproj
9 +*.md
docker/Dockerfile
+21 -8
@@ -5,17 +5,30 @@ FROM node:slim
5 #Add non-root user, add installation directories and assign proper permissions
6 RUN mkdir -p /opt/meshcentral
7
8 -#meshcentral installation
8 +# meshcentral installation
9 WORKDIR /opt/meshcentral
10
11 -RUN npm install meshcentral
11
13 -#Install dependencies for plugins
14 -RUN npm install nedb
12
16 -COPY config.json.template /opt/meshcentral/config.json.template
17 -COPY startup.sh startup.sh
18 -#environment variables
13 +RUN mkdir /opt/meshcentral/meshcentral
14 +COPY ./ /opt/meshcentral/meshcentral/
15 +COPY ./docker/config.json.template /opt/meshcentral/config.json.template
16 +COPY ./docker/startup.sh startup.sh
17 +RUN rm -rf ./docker
18 +
19 +# install dependencies from package.json
20 +RUN cd meshcentral && npm install
21 +
22 +# install dependencies for plugins
23 +RUN cd meshcentral && npm install nedb
24 +
25 +# minify files - first try throws Error: Cannot find module 'jsdom'
26 +RUN cd meshcentral/translate && node translate.js minifyall; exit 0
27 +RUN cd meshcentral/translate && node translate.js minifyall
28 +
29 +# translate
30 +RUN cd meshcentral/translate && node translate.js translateall
31 +RUN cd meshcentral/translate && node translate.js extractall
32
33 EXPOSE 80 443
34
@@ -23,4 +36,4 @@ EXPOSE 80 443
36 VOLUME /opt/meshcentral/meshcentral-data
37 VOLUME /opt/meshcentral/meshcentral-files
38
26 -CMD ["bash","/opt/meshcentral/startup.sh"]
39 +CMD ["bash", "/opt/meshcentral/startup.sh"]
docker/startup.sh
+6 -7
@@ -11,7 +11,7 @@ export WEBRTC
11
12 if [ -f "meshcentral-data/config.json" ]
13 then
14 - node node_modules/meshcentral
14 + node meshcentral/meshcentral
15 else
16 cp config.json.template meshcentral-data/config.json
17 sed -i "s/\"cert\": \"myserver.mydomain.com\"/\"cert\": \"$HOSTNAME\"/" meshcentral-data/config.json
@@ -21,11 +21,10 @@ if [ -f "meshcentral-data/config.json" ]
21 sed -i "s/\"minify\": true/\"minify\": \"$MINIFY\"/" meshcentral-data/config.json
22 sed -i "s/\"WebRTC\": false/\"WebRTC\": \"$WEBRTC\"/" meshcentral-data/config.json
23 sed -i "s/\"AllowFraming\": false/\"AllowFraming\": \"$IFRAME\"/" meshcentral-data/config.json
24 - if [ "$REVERSE_PROXY" != "false" ]
25 - then
26 - sed -i "s/\"_certUrl\": \"my\.reverse\.proxy\"/\"certUrl\": \"https:\/\/$REVERSE_PROXY:$REVERSE_PROXY_TLS_PORT\"/" meshcentral-data/config.json
27 - node node_modules/meshcentral
28 - exit
24 + if [ "$REVERSE_PROXY" != "false" ]; then
25 + sed -i "s/\"_certUrl\": \"my\.reverse\.proxy\"/\"certUrl\": \"https:\/\/$REVERSE_PROXY:$REVERSE_PROXY_TLS_PORT\"/" meshcentral-data/config.json
26 + node meshcentral/meshcentral
27 + exit
28 fi
30 - node node_modules/meshcentral --cert "$HOSTNAME"
29 + node meshcentral/meshcentral --cert "$HOSTNAME"
30 fi
\ No newline at end of file