Switch Docker install from npm install to npm ci to fix build hang
npm install re-resolves the full dependency tree from the registry on
every --no-cache build, making two full network round-trips (root + client).
Any slow registry response causes it to appear hung.
Changes:
- Replace both 'npm install' with 'npm ci':
no dependency resolution step, uses lockfile as-is, exits fast on
any mismatch rather than silently upgrading
- Copy package.json + package-lock.json explicitly (not glob) so the
lockfile is always present for npm ci to validate against
- Set npm fetch timeouts (5s min, 30s max, 3 retries) so failures
surface quickly rather than hanging indefinitely
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -5,13 +5,19 @@ WORKDIR /app
|
|||||||
# Install build tools + OpenSSL (required by Prisma query engine on Alpine)
|
# Install build tools + OpenSSL (required by Prisma query engine on Alpine)
|
||||||
RUN apk add --no-cache python3 make g++ openssl openssl-dev
|
RUN apk add --no-cache python3 make g++ openssl openssl-dev
|
||||||
|
|
||||||
# Copy package manifests
|
# Configure npm: disable package-lock update, cap network retries/timeout
|
||||||
COPY package*.json ./
|
RUN npm config set fetch-retry-mintimeout 5000 \
|
||||||
COPY client/package*.json ./client/
|
&& npm config set fetch-retry-maxtimeout 30000 \
|
||||||
|
&& npm config set fetch-retries 3 \
|
||||||
|
&& npm config set prefer-offline false
|
||||||
|
|
||||||
# Install all dependencies (dev deps needed for prisma CLI + tsc build)
|
# Copy lockfiles + manifests together so npm ci can validate the lockfile
|
||||||
RUN npm install
|
COPY package.json package-lock.json ./
|
||||||
RUN cd client && npm install
|
COPY client/package.json client/package-lock.json ./client/
|
||||||
|
|
||||||
|
# Use npm ci (lockfile-exact, no resolution step, much faster than npm install)
|
||||||
|
RUN npm ci
|
||||||
|
RUN cd client && npm ci
|
||||||
|
|
||||||
# Copy source
|
# Copy source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
Reference in New Issue
Block a user