File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,8 +4,9 @@ FROM node:20-alpine AS builder
44# Set working directory
55WORKDIR /app
66
7- # Copy package files
7+ # Copy package files and postinstall script
88COPY package*.json ./
9+ COPY scripts ./scripts
910
1011# Install ALL dependencies (including dev dependencies for build)
1112RUN npm ci && npm cache clean --force
@@ -35,8 +36,9 @@ RUN addgroup -g 1001 -S nodejs && \
3536# Set working directory
3637WORKDIR /app
3738
38- # Copy package files
39+ # Copy package files and postinstall script (required before npm ci)
3940COPY package*.json ./
41+ COPY scripts ./scripts
4042
4143# Install only production dependencies
4244RUN npm ci --omit=dev && npm cache clean --force
Original file line number Diff line number Diff line change @@ -4,8 +4,9 @@ FROM node:20-alpine AS builder
44# Set working directory
55WORKDIR /app
66
7- # Copy package files
7+ # Copy package files and postinstall script (required before npm ci)
88COPY package*.json ./
9+ COPY scripts ./scripts
910
1011# Install ALL dependencies (including dev dependencies for build)
1112RUN npm ci && npm cache clean --force
@@ -35,8 +36,9 @@ RUN addgroup -g 1001 -S nodejs && \
3536# Set working directory
3637WORKDIR /app
3738
38- # Copy package files
39+ # Copy package files and postinstall script (required before npm ci)
3940COPY package*.json ./
41+ COPY scripts ./scripts
4042
4143# Install only production dependencies
4244RUN npm ci --omit=dev && npm cache clean --force
Original file line number Diff line number Diff line change @@ -5,8 +5,9 @@ RUN apk add --no-cache dumb-init
55
66WORKDIR /app
77
8- # Copy package files
8+ # Copy package files and postinstall script
99COPY package*.json ./
10+ COPY scripts ./scripts
1011
1112# Install all dependencies (including dev dependencies)
1213RUN npm install
Original file line number Diff line number Diff line change @@ -11,11 +11,23 @@ if (!existsSync(nm)) {
1111}
1212
1313const pkg = JSON . parse ( readFileSync ( join ( root , 'package.json' ) , 'utf8' ) )
14- const deps = {
15- ...pkg . dependencies ,
16- ...pkg . devDependencies ,
17- ...( pkg . optionalDependencies ?? { } ) ,
18- }
14+
15+ const omit = ( process . env . npm_config_omit ?? '' )
16+ . split ( / [ , + ] / )
17+ . map ( ( s ) => s . trim ( ) )
18+ . filter ( Boolean )
19+ const omitDev = omit . includes ( 'dev' )
20+
21+ const deps = omitDev
22+ ? {
23+ ...pkg . dependencies ,
24+ ...( pkg . optionalDependencies ?? { } ) ,
25+ }
26+ : {
27+ ...pkg . dependencies ,
28+ ...pkg . devDependencies ,
29+ ...( pkg . optionalDependencies ?? { } ) ,
30+ }
1931
2032for ( const name of Object . keys ( deps ) ) {
2133 const segments = name . split ( '/' )
You can’t perform that action at this time.
0 commit comments