2022-06-07 20:46:40 -04:00
|
|
|
FROM node:current-alpine AS base
|
2021-11-02 09:54:10 -04:00
|
|
|
|
|
|
|
#Add non-root user, add installation directories and assign proper permissions
|
|
|
|
RUN mkdir -p /opt/meshcentral
|
|
|
|
|
2022-06-06 13:39:36 -04:00
|
|
|
# meshcentral installation
|
2021-11-02 09:54:10 -04:00
|
|
|
WORKDIR /opt/meshcentral
|
|
|
|
|
2022-06-07 08:53:16 -04:00
|
|
|
RUN apk add --no-cache bash
|
2021-12-12 16:04:21 -05:00
|
|
|
|
2022-06-06 13:39:36 -04:00
|
|
|
|
2022-06-07 20:46:40 -04:00
|
|
|
FROM base AS builder
|
2022-06-06 13:39:36 -04:00
|
|
|
|
2022-06-07 20:46:40 -04:00
|
|
|
RUN mkdir /opt/meshcentral/meshcentral
|
|
|
|
COPY ./ /opt/meshcentral/meshcentral/
|
2022-06-06 13:39:36 -04:00
|
|
|
|
|
|
|
# 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
|
2021-11-02 09:54:10 -04:00
|
|
|
|
2022-06-07 20:46:40 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
RUN cd meshcentral && npm install
|
|
|
|
|
|
|
|
# install dependencies for plugins
|
|
|
|
RUN cd meshcentral && npm install nedb
|
|
|
|
|
2022-06-07 08:53:16 -04:00
|
|
|
EXPOSE 80 443 4433
|
2021-11-02 09:54:10 -04:00
|
|
|
|
2022-06-06 13:40:49 -04:00
|
|
|
# volumes
|
2021-11-02 09:54:10 -04:00
|
|
|
VOLUME /opt/meshcentral/meshcentral-data
|
|
|
|
VOLUME /opt/meshcentral/meshcentral-files
|
2022-06-06 13:40:49 -04:00
|
|
|
VOLUME /opt/meshcentral/meshcentral-web
|
|
|
|
VOLUME /opt/meshcentral/meshcentral-backup
|
2021-11-02 09:54:10 -04:00
|
|
|
|
2022-06-06 13:39:36 -04:00
|
|
|
CMD ["bash", "/opt/meshcentral/startup.sh"]
|