From d1d08437a913eca5f047ab693e38f5f7fe513a85 Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:39:09 +0200 Subject: [PATCH] Dockerfile: fix build for specific arch --- Dockerfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 57cb478d..2a4081fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,20 @@ # nodejs 20 hangs on build with armv6/armv7 FROM docker.io/library/node:18-alpine AS build_node_modules +# Set the platform to build image for +ARG TARGETPLATFORM +ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64} + +# Install additional tools needed if on arm64 / armv7 / armv6 +RUN \ + case "${TARGETPLATFORM}" in \ + 'linux/arm64') apk add --no-cache python3 make g++ ;; \ + 'linux/arm/v7') apk add --no-cache python3 make g++ ;; \ + 'linux/arm/v6') apk add --no-cache python3 make g++ ;; \ + esac + # Update npm to latest -RUN npm install -g npm@latest node-gyp +RUN npm install -g npm@latest # Copy Web UI COPY src /app