mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 19:11:51 +00:00
Merge branch 'master' of https://github.com/Ylianst/MeshCentral
This commit is contained in:
commit
211eb7407e
6 changed files with 1336 additions and 15 deletions
|
@ -1,6 +1,9 @@
|
||||||
|
/*.txt
|
||||||
|
node_modules/
|
||||||
.github/
|
.github/
|
||||||
.vscode/
|
.vscode/
|
||||||
docs/
|
docs/
|
||||||
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
.gitlab-ci.yml
|
.gitlab-ci.yml
|
||||||
*.bat
|
*.bat
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
FROM node:current-alpine
|
FROM node:current-alpine AS base
|
||||||
|
|
||||||
ARG INCLUDE_MONGODBTOOLS=""
|
|
||||||
|
|
||||||
#Add non-root user, add installation directories and assign proper permissions
|
#Add non-root user, add installation directories and assign proper permissions
|
||||||
RUN mkdir -p /opt/meshcentral
|
RUN mkdir -p /opt/meshcentral
|
||||||
|
@ -9,13 +7,40 @@ RUN mkdir -p /opt/meshcentral
|
||||||
WORKDIR /opt/meshcentral
|
WORKDIR /opt/meshcentral
|
||||||
|
|
||||||
RUN apk add --no-cache bash
|
RUN apk add --no-cache bash
|
||||||
RUN if [ "$INCLUDE_MONGODBTOOLS" == "yes" ] || [ "$INCLUDE_MONGODBTOOLS" == "YES" ]; then apk add --no-cache mongodb-tools; fi
|
|
||||||
|
|
||||||
|
FROM base AS builder
|
||||||
|
|
||||||
|
ARG DISABLE_TRANSLATE=""
|
||||||
|
ARG DISABLE_MINIFY=""
|
||||||
|
|
||||||
RUN mkdir /opt/meshcentral/meshcentral
|
RUN mkdir /opt/meshcentral/meshcentral
|
||||||
COPY ./ /opt/meshcentral/meshcentral/
|
COPY ./ /opt/meshcentral/meshcentral/
|
||||||
COPY ./docker/config.json.template /opt/meshcentral/config.json.template
|
|
||||||
COPY ./docker/startup.sh startup.sh
|
# Extract all MeshCentral strings from web pages and generate the languages.json file. - first try throws Error: Cannot find module 'jsdom'
|
||||||
RUN rm -rf ./docker
|
RUN cd meshcentral/translate && node translate.js extractall; exit 0;
|
||||||
|
RUN cd meshcentral/translate && node translate.js extractall
|
||||||
|
|
||||||
|
# minify files
|
||||||
|
RUN if [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ]; then cd meshcentral/translate && node translate.js minifyall; fi
|
||||||
|
|
||||||
|
# translate
|
||||||
|
RUN if [ "$DISABLE_TRANSLATE" != "yes" ] && [ "$DISABLE_TRANSLATE" != "YES" ]; then cd meshcentral/translate && node translate.js translateall; fi
|
||||||
|
|
||||||
|
|
||||||
|
FROM base
|
||||||
|
|
||||||
|
ARG INCLUDE_MONGODBTOOLS=""
|
||||||
|
RUN if [ "$INCLUDE_MONGODBTOOLS" == "yes" ] || [ "$INCLUDE_MONGODBTOOLS" == "YES" ]; then apk add --no-cache mongodb-tools; fi
|
||||||
|
|
||||||
|
# copy files from builder-image
|
||||||
|
COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
|
||||||
|
COPY --from=builder /opt/meshcentral/meshcentral/docker/startup.sh ./startup.sh
|
||||||
|
COPY --from=builder /opt/meshcentral/meshcentral/docker/config.json.template /opt/meshcentral/config.json.template
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
RUN rm -rf /opt/meshcentral/meshcentral/docker
|
||||||
|
RUN rm -rf /opt/meshcentral/meshcentral/node_modules
|
||||||
|
|
||||||
# install dependencies from package.json
|
# install dependencies from package.json
|
||||||
RUN cd meshcentral && npm install
|
RUN cd meshcentral && npm install
|
||||||
|
@ -23,14 +48,6 @@ RUN cd meshcentral && npm install
|
||||||
# install dependencies for plugins
|
# install dependencies for plugins
|
||||||
RUN cd meshcentral && npm install nedb
|
RUN cd meshcentral && npm install nedb
|
||||||
|
|
||||||
# minify files - first try throws Error: Cannot find module 'jsdom'
|
|
||||||
RUN cd meshcentral/translate && node translate.js minifyall; exit 0
|
|
||||||
RUN cd meshcentral/translate && node translate.js minifyall
|
|
||||||
|
|
||||||
# translate
|
|
||||||
RUN cd meshcentral/translate && node translate.js translateall
|
|
||||||
RUN cd meshcentral/translate && node translate.js extractall
|
|
||||||
|
|
||||||
EXPOSE 80 443 4433
|
EXPOSE 80 443 4433
|
||||||
|
|
||||||
# volumes
|
# volumes
|
||||||
|
|
75
docker/docker.build.sh
Normal file
75
docker/docker.build.sh
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MSG="";
|
||||||
|
PRUNE="false";
|
||||||
|
|
||||||
|
function appendOutput()
|
||||||
|
{
|
||||||
|
if [ -z "${MSG}" ]; then echo -e "\n" > /dev/tty; fi
|
||||||
|
|
||||||
|
ARGS=$@;
|
||||||
|
LINE="${ARGS}\n"
|
||||||
|
echo -e "${LINE}" > /dev/tty;
|
||||||
|
|
||||||
|
MSG="${MSG}${LINE}";
|
||||||
|
}
|
||||||
|
|
||||||
|
function runDockerBuild()
|
||||||
|
{
|
||||||
|
if [ "${PRUNE}" == "true" ]; then docker system prune -a -f; fi
|
||||||
|
|
||||||
|
STARTTS=$(date +%s);
|
||||||
|
ARGS=$@;
|
||||||
|
|
||||||
|
BUILD_CMD="docker build -f docker/Dockerfile --force-rm --no-cache ${ARGS} -t meshcentral .";
|
||||||
|
appendOutput "Current build: ${BUILD_CMD}";
|
||||||
|
|
||||||
|
${BUILD_CMD};
|
||||||
|
if [ $? -ne 0 ]; then exit $?; fi
|
||||||
|
|
||||||
|
ENDTS=$(date +%s);
|
||||||
|
DIFSEC=$((${ENDTS}-${STARTTS}));
|
||||||
|
if [ ${DIFSEC} -ge 60 ]; then
|
||||||
|
TMPMIN=$((${DIFSEC}/60));
|
||||||
|
TMPSEC=$((${DIFSEC}%60));
|
||||||
|
|
||||||
|
if [ ${TMPMIN} -ge 60 ]; then
|
||||||
|
TMPHOUR=$((${TMPMIN}/60));
|
||||||
|
TMPMIN=$((${TMPMIN}%60));
|
||||||
|
|
||||||
|
appendOutput "\tBuild time: ${TMPHOUR} hr ${TMPMIN} min ${TMPSEC} sec";
|
||||||
|
else appendOutput "\tBuild time: ${TMPMIN} min ${TMPSEC} 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*//");
|
||||||
|
expr $IMG_SIZE + 0;
|
||||||
|
appendOutput "\tImage size: ${IMG_SIZE} ($((${IMG_SIZE}/1024/1024))M)";
|
||||||
|
|
||||||
|
appendOutput "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
parent_path=$(dirname -- $(dirname -- "$( readlink -f -- "$0"; )"));
|
||||||
|
if [ "${parent_path}" != "$(pwd -P)" ]; then
|
||||||
|
echo -e "change working directory to: ${parent_path}" > /dev/tty;
|
||||||
|
cd "${parent_path}";
|
||||||
|
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 INCLUDE_MONGOTOOLS=yes;
|
||||||
|
#runDockerBuild --build-arg INCLUDE_MONGOTOOLS=yes --build-arg DISABLE_MINIFY=yes;
|
||||||
|
#runDockerBuild --build-arg INCLUDE_MONGOTOOLS=yes --build-arg DISABLE_TRANSLATE=yes;
|
||||||
|
#runDockerBuild --build-arg INCLUDE_MONGOTOOLS=yes --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes;
|
||||||
|
|
||||||
|
echo "";
|
||||||
|
echo -e $MSG;
|
||||||
|
|
||||||
|
exit 0;
|
|
@ -21,6 +21,13 @@
|
||||||
> | --force-rm | Always remove intermediate containers |
|
> | --force-rm | Always remove intermediate containers |
|
||||||
> | -t meshcentral | Name and optionally a tag in the 'name:tag' format |
|
> | -t meshcentral | Name and optionally a tag in the 'name:tag' format |
|
||||||
|
|
||||||
|
### Optional build arguments
|
||||||
|
> | Argument | Description |
|
||||||
|
> | :--- | :--- |
|
||||||
|
> | INCLUDE_MONGOTOOLS=yes | Includes mongodb-tools (mongodump, ...) in the image |
|
||||||
|
> | DISABLE_MINIFY=yes | Disables the minification of files |
|
||||||
|
> | DISABLE_TRANSLATE=yes | Disables the translation of files |
|
||||||
|
|
||||||
# Create folder-structure and files
|
# Create folder-structure and files
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
1218
docs/docs/meshcentral/config.md
Normal file
1218
docs/docs/meshcentral/config.md
Normal file
File diff suppressed because it is too large
Load diff
|
@ -8,6 +8,7 @@ nav:
|
||||||
|
|
||||||
- MeshCentral2:
|
- MeshCentral2:
|
||||||
- 'MeshCentral2 Guide': 'meshcentral/index.md'
|
- 'MeshCentral2 Guide': 'meshcentral/index.md'
|
||||||
|
- 'All Configuration Options': 'meshcentral/config.md'
|
||||||
- 'Tokens': 'meshcentral/tokens.md'
|
- 'Tokens': 'meshcentral/tokens.md'
|
||||||
- 'Assistant': 'meshcentral/assistant.md'
|
- 'Assistant': 'meshcentral/assistant.md'
|
||||||
- 'Debugging': 'meshcentral/debugging.md'
|
- 'Debugging': 'meshcentral/debugging.md'
|
||||||
|
|
Loading…
Reference in a new issue