Skip to content

Commit 4230021

Browse files
committed
.
1 parent 4783ee4 commit 4230021

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Dockerfile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
# Build stage
2-
FROM node:22-alpine AS builder
2+
FROM node:22-slim AS builder
33

4-
# Install dependencies
5-
RUN apk add --no-cache libc6-compat python3 make g++
4+
# Install build dependencies
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
python3 \
7+
make \
8+
g++ \
9+
&& rm -rf /var/lib/apt/lists/*
610

711
WORKDIR /app
812

913
# Copy package files
10-
COPY package.json package-lock.json* ./
14+
COPY package.json ./
1115

12-
# Install dependencies with optional dependencies
13-
# The --include=optional flag ensures rollup native binaries are installed
14-
RUN npm install --include=optional || (rm -f package-lock.json && npm install --include=optional)
16+
# Remove package-lock.json and node_modules as suggested by the error message
17+
# This fixes npm's bug with optional dependencies
18+
RUN rm -rf package-lock.json node_modules 2>/dev/null || true
19+
20+
# Install dependencies fresh (this ensures rollup native binaries are properly installed)
21+
RUN npm install --include=optional
1522

1623
# Copy source code
1724
COPY . .

0 commit comments

Comments
 (0)