Remove frontend npm tuning and keep standard install path
This commit is contained in:
@@ -44,14 +44,6 @@ VITE_API_BASE=
|
|||||||
# Development-only Vite host allowlist override.
|
# Development-only Vite host allowlist override.
|
||||||
VITE_ALLOWED_HOSTS=
|
VITE_ALLOWED_HOSTS=
|
||||||
|
|
||||||
# Optional frontend build network and npm fetch tuning:
|
|
||||||
DOCKER_BUILD_NETWORK=default
|
|
||||||
NPM_REGISTRY=https://registry.npmjs.org/
|
|
||||||
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):
|
# Production baseline overrides (set explicitly for live deployments):
|
||||||
# APP_ENV=production
|
# APP_ENV=production
|
||||||
# HOST_BIND_IP=127.0.0.1
|
# HOST_BIND_IP=127.0.0.1
|
||||||
|
|||||||
@@ -42,24 +42,9 @@ Tail logs:
|
|||||||
docker compose logs -f
|
docker compose logs -f
|
||||||
```
|
```
|
||||||
|
|
||||||
## Frontend Build Network Resilience
|
## Frontend Build Baseline
|
||||||
|
|
||||||
The frontend Dockerfile uses `node:22-slim` by default for improved npm network compatibility on IPv4-only Linux hosts.
|
The frontend Dockerfile uses `node:22-slim` with a standard `npm ci --no-audit` install step and no npm-specific build tuning flags.
|
||||||
|
|
||||||
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 `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`, keep defaults first, then try:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
DOCKER_BUILD_NETWORK=host docker compose build --no-cache frontend
|
|
||||||
```
|
|
||||||
|
|
||||||
## Authentication Model
|
## Authentication Model
|
||||||
|
|
||||||
|
|||||||
@@ -144,14 +144,8 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
target: ${APP_ENV:-development}
|
target: ${APP_ENV:-development}
|
||||||
network: ${DOCKER_BUILD_NETWORK:-default}
|
|
||||||
args:
|
args:
|
||||||
VITE_API_BASE: ${VITE_API_BASE:-}
|
VITE_API_BASE: ${VITE_API_BASE:-}
|
||||||
NPM_REGISTRY: ${NPM_REGISTRY:-https://registry.npmjs.org/}
|
|
||||||
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:
|
environment:
|
||||||
VITE_API_BASE: ${VITE_API_BASE:-}
|
VITE_API_BASE: ${VITE_API_BASE:-}
|
||||||
CORS_ORIGINS: '${CORS_ORIGINS:-["http://localhost:5173","http://localhost:3000"]}'
|
CORS_ORIGINS: '${CORS_ORIGINS:-["http://localhost:5173","http://localhost:3000"]}'
|
||||||
|
|||||||
@@ -1,21 +1,10 @@
|
|||||||
FROM node:22-slim AS base
|
FROM node:22-slim AS base
|
||||||
|
|
||||||
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
|
||||||
ARG NPM_FETCH_RETRIES=5
|
|
||||||
ARG NPM_FETCH_RETRY_MINTIMEOUT=20000
|
|
||||||
ARG NPM_FETCH_RETRY_MAXTIMEOUT=120000
|
|
||||||
ARG NPM_FETCH_TIMEOUT=300000
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json /app/package.json
|
COPY package.json /app/package.json
|
||||||
COPY package-lock.json /app/package-lock.json
|
COPY package-lock.json /app/package-lock.json
|
||||||
RUN npm config set registry "${NPM_REGISTRY}" \
|
RUN npm ci --no-audit \
|
||||||
&& 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}" \
|
|
||||||
&& NODE_OPTIONS=--dns-result-order=ipv4first npm ci --no-audit \
|
|
||||||
&& chown -R node:node /app
|
&& chown -R node:node /app
|
||||||
|
|
||||||
COPY --chown=node:node tsconfig.json /app/tsconfig.json
|
COPY --chown=node:node tsconfig.json /app/tsconfig.json
|
||||||
|
|||||||
Reference in New Issue
Block a user