mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-05 10:48:05 -05:00
Merge pull request #4090 from sschoen/Bugfix/docker
removed .git folder from docker image (significant size improvement)
This commit is contained in:
commit
d7400118eb
@ -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,19 +7,12 @@ 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
|
||||||
|
|
||||||
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
|
|
||||||
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'
|
# 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; exit 0
|
||||||
@ -31,6 +22,27 @@ RUN cd meshcentral/translate && node translate.js minifyall
|
|||||||
RUN cd meshcentral/translate && node translate.js translateall
|
RUN cd meshcentral/translate && node translate.js translateall
|
||||||
RUN cd meshcentral/translate && node translate.js extractall
|
RUN cd meshcentral/translate && node translate.js extractall
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
EXPOSE 80 443 4433
|
EXPOSE 80 443 4433
|
||||||
|
|
||||||
# volumes
|
# volumes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user