2021-11-02 09:54:10 -04:00
|
|
|
# Filename: Dockerfile
|
|
|
|
|
2022-05-21 16:29:40 -04:00
|
|
|
FROM node:slim
|
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-06 13:40:16 -04:00
|
|
|
# add mongodb repository to apt
|
|
|
|
RUN apt-get update && apt-get install -y gnupg2 wget
|
|
|
|
RUN wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add -
|
|
|
|
RUN echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 main" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
|
|
|
|
|
|
|
# install mongodb
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y mongodb-org-tools \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2021-12-12 16:04:21 -05:00
|
|
|
|
2022-06-06 13:39:36 -04:00
|
|
|
RUN mkdir /opt/meshcentral/meshcentral
|
|
|
|
COPY ./ /opt/meshcentral/meshcentral/
|
|
|
|
COPY ./docker/config.json.template /opt/meshcentral/config.json.template
|
|
|
|
COPY ./docker/startup.sh startup.sh
|
|
|
|
RUN rm -rf ./docker
|
|
|
|
|
|
|
|
# install dependencies from package.json
|
|
|
|
RUN cd meshcentral && npm install
|
|
|
|
|
|
|
|
# install dependencies for plugins
|
|
|
|
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
|
2021-11-02 09:54:10 -04:00
|
|
|
|
|
|
|
EXPOSE 80 443
|
|
|
|
|
|
|
|
#volumes
|
|
|
|
VOLUME /opt/meshcentral/meshcentral-data
|
|
|
|
VOLUME /opt/meshcentral/meshcentral-files
|
|
|
|
|
2022-06-06 13:39:36 -04:00
|
|
|
CMD ["bash", "/opt/meshcentral/startup.sh"]
|