mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-13 07:53:20 -05:00
bugfix: run 'node translate.js extractall' only when DISABLE_TRANSLATE is not set
This commit is contained in:
parent
d06ca601ff
commit
cf553d1a0f
@ -11,27 +11,41 @@ RUN apk add --no-cache bash
|
|||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
|
||||||
ARG DISABLE_TRANSLATE=""
|
|
||||||
ARG DISABLE_MINIFY=""
|
ARG DISABLE_MINIFY=""
|
||||||
|
ARG DISABLE_TRANSLATE=""
|
||||||
|
|
||||||
RUN mkdir /opt/meshcentral/meshcentral
|
RUN mkdir /opt/meshcentral/meshcentral
|
||||||
COPY ./ /opt/meshcentral/meshcentral/
|
COPY ./ /opt/meshcentral/meshcentral/
|
||||||
|
|
||||||
# Extract all MeshCentral strings from web pages and generate the languages.json file. - first try throws Error: Cannot find module 'jsdom'
|
RUN if ! [ -z "$DISABLE_MINIFY" ] && [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ] \
|
||||||
RUN cd meshcentral/translate && node translate.js extractall; exit 0;
|
&& [ "$DISABLE_MINIFY" != "true" ] && [ "$DISABLE_MINIFY" != "TRUE" ]; then \
|
||||||
RUN cd meshcentral/translate && node translate.js extractall
|
echo -e "\e[0;31;49mInvalid value for build argument DISABLE_MINIFY, possible values: yes/true\e[;0m"; exit 1; \
|
||||||
|
fi
|
||||||
|
RUN if ! [ -z "$DISABLE_TRANSLATE" ] && [ "$DISABLE_TRANSLATE" != "yes" ] && [ "$DISABLE_TRANSLATE" != "YES" ] \
|
||||||
|
&& [ "$DISABLE_TRANSLATE" != "true" ] && [ "$DISABLE_TRANSLATE" != "TRUE" ]; then \
|
||||||
|
echo -e "\e[0;31;49mInvalid value for build argument DISABLE_TRANSLATE, possible values: yes/true\e[;0m"; exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# first try throws Error: Cannot find module 'jsdom'
|
||||||
|
RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; exit 0; fi
|
||||||
|
|
||||||
# minify files
|
# minify files
|
||||||
RUN if [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ]; then cd meshcentral/translate && node translate.js minifyall; fi
|
RUN if [ -z "$DISABLE_MINIFY" ]; then cd meshcentral/translate && node translate.js minifyall; fi
|
||||||
|
|
||||||
# translate
|
# translate
|
||||||
RUN if [ "$DISABLE_TRANSLATE" != "yes" ] && [ "$DISABLE_TRANSLATE" != "YES" ]; then cd meshcentral/translate && node translate.js translateall; fi
|
RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; fi
|
||||||
|
RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js translateall; fi
|
||||||
|
|
||||||
|
|
||||||
FROM base
|
FROM base
|
||||||
|
|
||||||
ARG INCLUDE_MONGODBTOOLS=""
|
ARG INCLUDE_MONGODBTOOLS=""
|
||||||
RUN if [ "$INCLUDE_MONGODBTOOLS" == "yes" ] || [ "$INCLUDE_MONGODBTOOLS" == "YES" ]; then apk add --no-cache mongodb-tools; fi
|
RUN if ! [ -z "$INCLUDE_MONGODBTOOLS" ] && [ "$INCLUDE_MONGODBTOOLS" != "yes" ] && [ "$INCLUDE_MONGODBTOOLS" != "YES" ] \
|
||||||
|
&& [ "$INCLUDE_MONGODBTOOLS" != "true" ] && [ "$INCLUDE_MONGODBTOOLS" != "TRUE" ]; then \
|
||||||
|
echo -e "\e[0;31;49mInvalid value for build argument INCLUDE_MONGODBTOOLS, possible values: yes/true\e[;0m"; exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN if ! [ -z "$INCLUDE_MONGODBTOOLS" ]; then apk add --no-cache mongodb-tools; fi
|
||||||
|
|
||||||
# copy files from builder-image
|
# copy files from builder-image
|
||||||
COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
|
COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
|
||||||
|
@ -3,13 +3,16 @@
|
|||||||
MSG="";
|
MSG="";
|
||||||
PRUNE="false";
|
PRUNE="false";
|
||||||
|
|
||||||
|
LOG_FILE=""
|
||||||
|
#LOG_FILE="$(dirname -- "$( readlink -f -- "$0"; )")/build.log";
|
||||||
|
|
||||||
function appendOutput()
|
function appendOutput()
|
||||||
{
|
{
|
||||||
if [ -z "${MSG}" ]; then echo -e "\n" > /dev/tty; fi
|
if [ -z "${MSG}" ]; then echo -e "\n" > /dev/tty; fi
|
||||||
|
|
||||||
ARGS=$@;
|
ARGS=$@;
|
||||||
LINE="${ARGS}\n"
|
LINE="${ARGS}\n";
|
||||||
echo -e "${LINE}" > /dev/tty;
|
if [ -z "${LOG_FILE}" ]; then echo -e "${LINE}" > /dev/tty; else echo -e "${LINE}" &>> "${LOG_FILE}"; fi
|
||||||
|
|
||||||
MSG="${MSG}${LINE}";
|
MSG="${MSG}${LINE}";
|
||||||
}
|
}
|
||||||
@ -24,7 +27,7 @@ function runDockerBuild()
|
|||||||
BUILD_CMD="docker build -f docker/Dockerfile --force-rm --no-cache ${ARGS} -t meshcentral .";
|
BUILD_CMD="docker build -f docker/Dockerfile --force-rm --no-cache ${ARGS} -t meshcentral .";
|
||||||
appendOutput "Current build: ${BUILD_CMD}";
|
appendOutput "Current build: ${BUILD_CMD}";
|
||||||
|
|
||||||
${BUILD_CMD};
|
if [ -z "${LOG_FILE}" ]; then ${BUILD_CMD}; else ${BUILD_CMD} &>> "${LOG_FILE}"; fi
|
||||||
if [ $? -ne 0 ]; then exit $?; fi
|
if [ $? -ne 0 ]; then exit $?; fi
|
||||||
|
|
||||||
ENDTS=$(date +%s);
|
ENDTS=$(date +%s);
|
||||||
@ -42,15 +45,12 @@ function runDockerBuild()
|
|||||||
else appendOutput "\tBuild time: ${DIFSEC} sec"; fi
|
else appendOutput "\tBuild time: ${DIFSEC} sec"; fi
|
||||||
|
|
||||||
IMG_SIZE=$(docker image inspect meshcentral | grep -e "\"Size\"" | tr -d '",' | sed -E "s/\s*Size:\s*//");
|
IMG_SIZE=$(docker image inspect meshcentral | grep -e "\"Size\"" | tr -d '",' | sed -E "s/\s*Size:\s*//");
|
||||||
expr $IMG_SIZE + 0;
|
expr $IMG_SIZE + 0 > /dev/null;
|
||||||
appendOutput "\tImage size: ${IMG_SIZE} ($((${IMG_SIZE}/1024/1024))M)";
|
appendOutput "\tImage size: ${IMG_SIZE} ($((${IMG_SIZE}/1024/1024))M)\n";
|
||||||
|
|
||||||
appendOutput "\n";
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
parent_path=$(dirname -- $(dirname -- "$( readlink -f -- "$0"; )"));
|
parent_path=$(dirname -- $(dirname -- "$( readlink -f -- "$0"; )"));
|
||||||
if [ "${parent_path}" != "$(pwd -P)" ]; then
|
if [ "${parent_path}" != "$(pwd -P)" ]; then
|
||||||
echo -e "change working directory to: ${parent_path}" > /dev/tty;
|
echo -e "change working directory to: ${parent_path}" > /dev/tty;
|
||||||
@ -59,17 +59,17 @@ fi
|
|||||||
|
|
||||||
if ! [ -z $1 ] && [ "${1}" == "prune" ]; then PRUNE="true"; fi
|
if ! [ -z $1 ] && [ "${1}" == "prune" ]; then PRUNE="true"; fi
|
||||||
|
|
||||||
runDockerBuild;
|
|
||||||
#runDockerBuild --build-arg DISABLE_MINIFY=yes;
|
|
||||||
#runDockerBuild --build-arg DISABLE_TRANSLATE=yes;
|
|
||||||
#runDockerBuild --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes;
|
#runDockerBuild --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes;
|
||||||
|
#runDockerBuild --build-arg DISABLE_TRANSLATE=yes;
|
||||||
|
#runDockerBuild --build-arg DISABLE_MINIFY=yes;
|
||||||
|
runDockerBuild;
|
||||||
|
|
||||||
#runDockerBuild --build-arg INCLUDE_MONGOTOOLS=yes;
|
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes;
|
||||||
#runDockerBuild --build-arg INCLUDE_MONGOTOOLS=yes --build-arg DISABLE_MINIFY=yes;
|
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_TRANSLATE=yes;
|
||||||
#runDockerBuild --build-arg INCLUDE_MONGOTOOLS=yes --build-arg DISABLE_TRANSLATE=yes;
|
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes;
|
||||||
#runDockerBuild --build-arg INCLUDE_MONGOTOOLS=yes --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes;
|
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes;
|
||||||
|
|
||||||
echo "";
|
echo "";
|
||||||
echo -e $MSG;
|
echo -e "${MSG}";
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
### Optional build arguments
|
### Optional build arguments
|
||||||
> | Argument | Description |
|
> | Argument | Description |
|
||||||
> | :--- | :--- |
|
> | :--- | :--- |
|
||||||
> | INCLUDE_MONGOTOOLS=yes | Includes mongodb-tools (mongodump, ...) in the image |
|
> | INCLUDE_MONGODBTOOLS=yes | Includes mongodb-tools (mongodump, ...) in the image |
|
||||||
> | DISABLE_MINIFY=yes | Disables the minification of files |
|
> | DISABLE_MINIFY=yes | Disables the minification of files |
|
||||||
> | DISABLE_TRANSLATE=yes | Disables the translation of files |
|
> | DISABLE_TRANSLATE=yes | Disables the translation of files |
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ if [ -f "meshcentral-data/config.json" ]
|
|||||||
node meshcentral/meshcentral
|
node meshcentral/meshcentral
|
||||||
else
|
else
|
||||||
cp config.json.template meshcentral-data/config.json
|
cp config.json.template meshcentral-data/config.json
|
||||||
if [ $USE_MONGODB == true ]; then
|
if ! [ -z "$USE_MONGODB" ] && [ "$USE_MONGODB" == "true" ]; then
|
||||||
sed -i "s/\"_mongoDb\": null/\"mongoDb\": \"mongodb:\/\/$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:27017\"/" meshcentral-data/config.json
|
sed -i "s/\"_mongoDb\": null/\"mongoDb\": \"mongodb:\/\/$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:27017\"/" meshcentral-data/config.json
|
||||||
fi
|
fi
|
||||||
sed -i "s/\"cert\": \"myserver.mydomain.com\"/\"cert\": \"$HOSTNAME\"/" meshcentral-data/config.json
|
sed -i "s/\"cert\": \"myserver.mydomain.com\"/\"cert\": \"$HOSTNAME\"/" meshcentral-data/config.json
|
||||||
|
Loading…
Reference in New Issue
Block a user