From 37b05f1dde43bacbc8285759095dc419c2bc4299 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Tue, 30 Sep 2025 10:01:11 -0500 Subject: [PATCH] Attempt to fix epipe error in docker build. --- docker/Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ef152449..d0598039 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,13 +6,22 @@ ARG BASE_TAG=base # --- Build frontend --- FROM node:24 AS frontend-builder +ARG TARGETOS=linux +ARG TARGETARCH=amd64 WORKDIR /app/frontend COPY ./frontend /app/frontend RUN set -eux; \ # remove any node_modules that may have been copied from the host (x86) rm -rf node_modules || true; \ - npm install --no-audit --progress=false; \ - npm run build; \ + # When building under emulation (buildx qemu) ensure npm downloads + # the esbuild binary for the target platform rather than the host. + # Also increase Node's memory for the build to avoid EPIPE/OOM + export NODE_OPTIONS="--max-old-space-size=4096"; \ + # If TARGETOS/TARGETARCH are provided by buildx, use those so this Dockerfile + # is multi-arch friendly; otherwise fall back to linux/amd64 defaults. + npm_config_platform="$TARGETOS" npm_config_arch="$TARGETARCH" npm install --no-audit --progress=false; \ + # Run build with the increased memory setting in the environment + NODE_OPTIONS="$NODE_OPTIONS" npm run build; \ rm -rf node_modules .cache # --- Redeclare build arguments for the next stage ---