From 66a86d3620372ee6b2a79fc2a28ae1c1a89e5d49 Mon Sep 17 00:00:00 2001 From: Davide Bert Date: Sun, 27 Sep 2026 17:20:47 +0200 Subject: [PATCH] fix(frontend): build Vite assets on BUILDPLATFORM for multi-arch Avoid QEMU illegal-instruction crashes during npm install when cross-building linux/arm64; static Vite output is arch-independent. Co-authored-by: Cursor --- frontend/Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 91103fe..a3826de 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,21 +1,22 @@ # Development stage FROM node:22-alpine AS development -RUN apk upgrade --no-cache \ - && npm install -g npm@latest +RUN apk upgrade --no-cache WORKDIR /app COPY package*.json ./ -RUN npm i +RUN npm ci COPY . . EXPOSE 3000 CMD ["npm", "run", "dev"] -# Build stage -FROM node:22-alpine AS build -RUN apk upgrade --no-cache \ - && npm install -g npm@latest +# Build stage — always on the native builder arch. +# Cross-compiling Node/npm under QEMU for linux/arm64 crashes with +# "qemu: uncaught target signal 4 (Illegal instruction)". Vite output is +# architecture-independent static files, so building on $BUILDPLATFORM is safe. +FROM --platform=$BUILDPLATFORM node:22-alpine AS build +RUN apk upgrade --no-cache WORKDIR /app COPY package*.json ./ -RUN npm i --include=dev +RUN npm ci --include=dev COPY . . RUN npm run build