From 78042827a5e72a27416e922fc5705edcd5f8cc48 Mon Sep 17 00:00:00 2001 From: Fabian Meyer <3982806+meyfa@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:59:42 +0100 Subject: [PATCH] fix: Fix arm64 build of sodium-native via node-gyp --- Dockerfile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 55b069e..4f793d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,24 +6,31 @@ WORKDIR /app COPY package*.json ./ COPY backend/package*.json ./backend/ COPY frontend/package*.json ./frontend/ -RUN npm ci +# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#node-gyp-alpine +RUN apk add --no-cache --virtual .gyp python3 py-setuptools make g++ \ + && npm ci \ + && apk del .gyp # copy in app code and build it COPY . . RUN npm run build - # -- execution -- FROM node:20.18.1-alpine WORKDIR /app RUN apk add --no-cache tini -# install PRODUCTION dependencies +# install production dependencies COPY package*.json ./ COPY backend/package*.json ./backend/ COPY frontend/package*.json ./frontend/ -RUN npm ci --omit=dev --workspace=backend --include-workspace-root && npm cache clean --force + +# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#node-gyp-alpine +RUN apk add --no-cache --virtual .gyp python3 py-setuptools make g++ \ + && npm ci --omit=dev --workspace=backend --include-workspace-root \ + && npm cache clean --force \ + && apk del .gyp # add the already compiled code and the default config # (custom config must be set via volume)