fix dockerfile

Simon Smith committed Jul 22, 2022 at 17:50 UTC d7e59b4868a3c117d2959ad707766d52138c19cc
1 file changed +9 -5
docker/Dockerfile
+9 -5
@@ -1,10 +1,10 @@
1 FROM node:current-alpine AS base
2
3 #Add non-root user, add installation directories and assign proper permissions
4 -RUN mkdir -p /opt/meshcentral/meshcentral
4 +RUN mkdir -p /opt/meshcentral
5
6 # meshcentral installation
7 -WORKDIR /opt/meshcentral/meshcentral
7 +WORKDIR /opt/meshcentral
8
9 RUN apk add --no-cache bash
10
@@ -14,6 +14,7 @@ FROM base AS builder
14 ARG DISABLE_MINIFY=""
15 ARG DISABLE_TRANSLATE=""
16
17 +RUN mkdir /opt/meshcentral/meshcentral
18 COPY ./ /opt/meshcentral/meshcentral/
19
20 RUN if ! [ -z "$DISABLE_MINIFY" ] && [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ] \
@@ -25,14 +26,17 @@ RUN if ! [ -z "$DISABLE_TRANSLATE" ] && [ "$DISABLE_TRANSLATE" != "yes" ] && [ "
26 echo -e "\e[0;31;49mInvalid value for build argument DISABLE_TRANSLATE, possible values: yes/true\e[;0m"; exit 1; \
27 fi
28
29 +# install translate/minify modules if need too
30 +RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral && npm install html-minifier jsdom minify-js; fi
31 +
32 # first extractall if need too
29 -RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then npm install html-minifier jsdom minify-js && cd translate && node translate.js extractall; fi
33 +RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; fi
34
35 # minify files
32 -RUN if [ -z "$DISABLE_MINIFY" ]; then cd translate && node translate.js minifyall; fi
36 +RUN if [ -z "$DISABLE_MINIFY" ]; then cd meshcentral/translate && node translate.js minifyall; fi
37
38 # translate
35 -RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd translate && node translate.js translateall; fi
39 +RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js translateall; fi
40
41
42 FROM base