[docker] changed baseimage to alpine:latest

This commit is contained in:
Simon Schön 2022-07-23 13:17:05 +02:00
parent 11612d5028
commit 6815c5d83d
No known key found for this signature in database
GPG Key ID: FD1F8B45F65D5B10

View File

@ -1,12 +1,15 @@
FROM node:current-alpine AS base FROM alpine:latest AS base
#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/meshcentral
# meshcentral installation # meshcentral installation
WORKDIR /opt/meshcentral WORKDIR /opt/meshcentral
RUN apk add --no-cache bash RUN apk update \
&& apk add --no-cache --update nodejs npm bash \
&& rm -rf /var/cache/apk/*
RUN npm install -g npm@latest
FROM base AS builder FROM base AS builder
@ -14,7 +17,6 @@ FROM base AS builder
ARG DISABLE_MINIFY="" ARG DISABLE_MINIFY=""
ARG DISABLE_TRANSLATE="" ARG DISABLE_TRANSLATE=""
RUN mkdir /opt/meshcentral/meshcentral
COPY ./ /opt/meshcentral/meshcentral/ COPY ./ /opt/meshcentral/meshcentral/
RUN if ! [ -z "$DISABLE_MINIFY" ] && [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ] \ RUN if ! [ -z "$DISABLE_MINIFY" ] && [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ] \
@ -38,6 +40,10 @@ RUN if [ -z "$DISABLE_MINIFY" ]; then cd meshcentral/translate && node translate
# translate # translate
RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js translateall; fi RUN if [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js translateall; fi
# cleanup
RUN rm -rf /opt/meshcentral/meshcentral/docker
RUN rm -rf /opt/meshcentral/meshcentral/node_modules
FROM base FROM base
@ -51,12 +57,8 @@ RUN if ! [ -z "$INCLUDE_MONGODBTOOLS" ]; then apk add --no-cache mongodb-tools;
# copy files from builder-image # copy files from builder-image
COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
COPY --from=builder /opt/meshcentral/meshcentral/docker/startup.sh ./startup.sh COPY ./docker/startup.sh ./startup.sh
COPY --from=builder /opt/meshcentral/meshcentral/docker/config.json.template /opt/meshcentral/config.json.template COPY ./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 and nedb # install dependencies from package.json and nedb
RUN cd meshcentral && npm install && npm install nedb RUN cd meshcentral && npm install && npm install nedb