adjust dockerfile to support multiplatform build
Alessandro Uffreduzzi committed
Nov 16, 2022 at 10:45 UTC
44affd39bf450113bb7240f13cd9171e74ea406f
1 file changed
+14
-14
docker/Dockerfile
+14
-14
@@ -1,23 +1,12 @@
1
-FROM alpine:latest AS base
1
+FROM --platform=$BUILDPLATFORM node:current-alpine AS builder
2
3
-#Add non-root user, add installation directories and assign proper permissions
3
RUN mkdir -p /opt/meshcentral/meshcentral
5
-
6
-# meshcentral installation
4
+COPY ./ /opt/meshcentral/meshcentral/
5
WORKDIR /opt/meshcentral
6
9
-RUN apk update \
10
- && apk add --no-cache --update tzdata nodejs npm bash \
11
- && rm -rf /var/cache/apk/*
12
-RUN npm install -g npm@latest
13
-
14
-
15
-FROM base AS builder
16
-
7
ARG DISABLE_MINIFY=""
8
ARG DISABLE_TRANSLATE=""
9
20
-COPY ./ /opt/meshcentral/meshcentral/
10
11
RUN if ! [ -z "$DISABLE_MINIFY" ] && [ "$DISABLE_MINIFY" != "yes" ] && [ "$DISABLE_MINIFY" != "YES" ] \
12
&& [ "$DISABLE_MINIFY" != "true" ] && [ "$DISABLE_MINIFY" != "TRUE" ]; then \
@@ -45,7 +34,18 @@ RUN rm -rf /opt/meshcentral/meshcentral/docker
34
RUN rm -rf /opt/meshcentral/meshcentral/node_modules
35
36
48
-FROM base
37
+FROM --platform=$TARGETPLATFORM alpine:latest
38
+
39
+#Add non-root user, add installation directories and assign proper permissions
40
+RUN mkdir -p /opt/meshcentral/meshcentral
41
+
42
+# meshcentral installation
43
+WORKDIR /opt/meshcentral
44
+
45
+RUN apk update \
46
+ && apk add --no-cache --update tzdata nodejs npm bash \
47
+ && rm -rf /var/cache/apk/*
48
+RUN npm install -g npm@latest
49
50
ARG INCLUDE_MONGODBTOOLS=""
51
ARG PREINSTALL_LIBS="false"