fix: add build tools and copy node_modules from builder

- Install python3, make, g++ in builder for native module compilation
- Copy node_modules from builder stage to avoid rebuild in production
- Fixes usb package compilation error in node:20-alpine
This commit is contained in:
2026-04-14 15:52:22 -04:00
parent d2e20ad82a
commit 84dd370673
+6 -3
View File
@@ -3,11 +3,14 @@ FROM node:20-alpine AS builder
WORKDIR /app
# Install build tools for native modules
RUN apk add --no-cache python3 make g++
# Copy root package files for workspace install
COPY package*.json ./
COPY frontend/package*.json ./frontend/
# Install dependencies using npm install (no individual lockfile in workspace)
# Install dependencies
RUN npm install --legacy-peer-deps
# Copy frontend source
@@ -26,8 +29,8 @@ WORKDIR /app
COPY package*.json ./
COPY frontend/package*.json ./frontend/
# Install production dependencies
RUN npm install --legacy-peer-deps --omit=dev
# Copy node_modules from builder (includes compiled native modules)
COPY --from=builder /app/node_modules ./node_modules
# Copy built files from builder
COPY --from=builder /app/frontend/.next ./frontend/.next