Revert "Harden frontend npm install against transient registry timeouts"
This reverts commit daa11cb768.
This commit is contained in:
@@ -47,10 +47,10 @@ VITE_ALLOWED_HOSTS=
|
||||
# Optional frontend build network and npm fetch tuning:
|
||||
DOCKER_BUILD_NETWORK=default
|
||||
NPM_REGISTRY=https://registry.npmjs.org/
|
||||
NPM_FETCH_RETRIES=10
|
||||
NPM_FETCH_RETRY_MINTIMEOUT=30000
|
||||
NPM_FETCH_RETRY_MAXTIMEOUT=300000
|
||||
NPM_FETCH_TIMEOUT=600000
|
||||
NPM_FETCH_RETRIES=5
|
||||
NPM_FETCH_RETRY_MINTIMEOUT=20000
|
||||
NPM_FETCH_RETRY_MAXTIMEOUT=120000
|
||||
NPM_FETCH_TIMEOUT=300000
|
||||
|
||||
# Production baseline overrides (set explicitly for live deployments):
|
||||
# APP_ENV=production
|
||||
|
||||
@@ -45,22 +45,20 @@ docker compose logs -f
|
||||
## Frontend Build Network Resilience
|
||||
|
||||
The frontend Dockerfile uses `node:22-slim` by default for improved npm network compatibility on IPv4-only Linux hosts.
|
||||
It also uses a BuildKit cache mount for npm package cache reuse across builds.
|
||||
|
||||
The frontend image build supports npm fetch tuning through environment-driven compose build args:
|
||||
|
||||
- `NPM_REGISTRY` (default `https://registry.npmjs.org/`)
|
||||
- `NPM_FETCH_RETRIES` (default `10`)
|
||||
- `NPM_FETCH_RETRY_MINTIMEOUT` (default `30000`)
|
||||
- `NPM_FETCH_RETRY_MAXTIMEOUT` (default `300000`)
|
||||
- `NPM_FETCH_TIMEOUT` (default `600000`)
|
||||
- `NPM_FETCH_RETRIES` (default `5`)
|
||||
- `NPM_FETCH_RETRY_MINTIMEOUT` (default `20000`)
|
||||
- `NPM_FETCH_RETRY_MAXTIMEOUT` (default `120000`)
|
||||
- `NPM_FETCH_TIMEOUT` (default `300000`)
|
||||
- `DOCKER_BUILD_NETWORK` (default `default`; set to `host` on Linux hosts when bridge-network npm fetches time out)
|
||||
|
||||
If frontend dependency downloads fail with npm `ETIMEDOUT` during `docker compose build`, prefer cache-preserving rebuild commands first:
|
||||
If frontend dependency downloads fail with npm `ETIMEDOUT` during `docker compose build`, keep defaults first, then try:
|
||||
|
||||
```bash
|
||||
docker compose build frontend
|
||||
DOCKER_BUILD_NETWORK=host docker compose build frontend
|
||||
DOCKER_BUILD_NETWORK=host docker compose build --no-cache frontend
|
||||
```
|
||||
|
||||
## Authentication Model
|
||||
|
||||
@@ -148,10 +148,10 @@ services:
|
||||
args:
|
||||
VITE_API_BASE: ${VITE_API_BASE:-}
|
||||
NPM_REGISTRY: ${NPM_REGISTRY:-https://registry.npmjs.org/}
|
||||
NPM_FETCH_RETRIES: ${NPM_FETCH_RETRIES:-10}
|
||||
NPM_FETCH_RETRY_MINTIMEOUT: ${NPM_FETCH_RETRY_MINTIMEOUT:-30000}
|
||||
NPM_FETCH_RETRY_MAXTIMEOUT: ${NPM_FETCH_RETRY_MAXTIMEOUT:-300000}
|
||||
NPM_FETCH_TIMEOUT: ${NPM_FETCH_TIMEOUT:-600000}
|
||||
NPM_FETCH_RETRIES: ${NPM_FETCH_RETRIES:-5}
|
||||
NPM_FETCH_RETRY_MINTIMEOUT: ${NPM_FETCH_RETRY_MINTIMEOUT:-20000}
|
||||
NPM_FETCH_RETRY_MAXTIMEOUT: ${NPM_FETCH_RETRY_MAXTIMEOUT:-120000}
|
||||
NPM_FETCH_TIMEOUT: ${NPM_FETCH_TIMEOUT:-300000}
|
||||
environment:
|
||||
VITE_API_BASE: ${VITE_API_BASE:-}
|
||||
CORS_ORIGINS: '${CORS_ORIGINS:-["http://localhost:5173","http://localhost:3000"]}'
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
FROM node:22-slim AS base
|
||||
|
||||
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
||||
@@ -12,14 +10,12 @@ WORKDIR /app
|
||||
|
||||
COPY package.json /app/package.json
|
||||
COPY package-lock.json /app/package-lock.json
|
||||
RUN --mount=type=cache,id=dcm-frontend-npm-cache,target=/root/.npm npm config set registry "${NPM_REGISTRY}" \
|
||||
RUN npm config set registry "${NPM_REGISTRY}" \
|
||||
&& npm config set fetch-retries "${NPM_FETCH_RETRIES}" \
|
||||
&& npm config set fetch-retry-mintimeout "${NPM_FETCH_RETRY_MINTIMEOUT}" \
|
||||
&& npm config set fetch-retry-maxtimeout "${NPM_FETCH_RETRY_MAXTIMEOUT}" \
|
||||
&& npm config set fetch-timeout "${NPM_FETCH_TIMEOUT}" \
|
||||
&& npm config set prefer-offline true \
|
||||
&& npm config set progress false \
|
||||
&& NODE_OPTIONS=--dns-result-order=ipv4first npm ci --no-audit --prefer-offline \
|
||||
&& NODE_OPTIONS=--dns-result-order=ipv4first npm ci --no-audit \
|
||||
&& chown -R node:node /app
|
||||
|
||||
COPY --chown=node:node tsconfig.json /app/tsconfig.json
|
||||
|
||||
Reference in New Issue
Block a user