diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..7f8b551d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,26 @@ +FROM node:stretch +MAINTAINER Lawrence Stubbs + +COPY startmeshcentral.sh / +RUN apt-get update \ + && apt-get install -y p7zip-full \ + && wget -q http://www.7-zip.org/a/lzma1604.7z \ + && 7z x lzma1604.7z -olzma1604 \ + && cp lzma1604/bin/*.sfx /usr/lib/p7zip/ \ + && rm -f lzma1604.7z \ + && rm -rf lzma1604 \ + && npm install -g forever + +RUN npm install greenlock-cli \ + && chmod +x /startmeshcentral.sh \ + && adduser --quiet meshcentral + +RUN su - meshcentral \ + && npm install meshcentral node-7z + +ENV PORT 443 +ENV REDIRPORT 80 + +EXPOSE 80 443 25 + +ENTRYPOINT ["/startmeshcentral.sh"] diff --git a/docker/startmeshcentral.sh b/docker/startmeshcentral.sh new file mode 100644 index 00000000..8553950c --- /dev/null +++ b/docker/startmeshcentral.sh @@ -0,0 +1,31 @@ +#!/bin/sh +export PORT +export REDIRPORT + +if [ $1 != "" ] ; then + PORT=$1 +fi + +if [ $2 != "" ]; then + REDIRPORT=$2 +fi + +cd /home/meshcentral +npmbin=$(which node) +$npmbin install meshcentral +foreverbin=$(which forever) +$foreverbin start node_modules/meshcentral/meshcentral.js --cert $HOSTNAME +sleep 10 +$foreverbin stop node_modules/meshcentral/meshcentral.js +if [ -f ssl.key ]; then + ln -sf ssl.key node_modules/.meshcentral-data/agentserver-cert-private.key + ln -sf ssl.cert node_modules/.meshcentral-data/agentserver-cert-public.crt + ln -sf ssl.key node_modules/.meshcentral-data/root-cert-private.key + ln -sf ssl.cert node_modules/.meshcentral-data/root-cert-public.crt + ln -sf ssl.key node_modules/.meshcentral-data/webserver-cert-private.key + ln -sf ssl.cert node_modules/.meshcentral-data/webserver-cert-public.crt + ln -sf ssl.key node_modules/.meshcentral-data/mpsserver-cert-private.key + ln -sf ssl.cert node_modules/.meshcentral-data/mpsserver-cert-public.crt +fi +$foreverbin start node_modules/meshcentral/meshcentral.js --port $PORT --redirport $REDIRPORT + \ No newline at end of file