Add custom npm registry/proxy support for frontend builds

Added configurable npm registry support to enable use of custom npm proxies or private registries during Docker builds. This is essential for corporate environments, air-gapped deployments, or when using npm mirrors.

**Changes:**
- Dockerfile.frontend: Added NPM_REGISTRY build argument with conditional configuration
- docker-compose.yml: Pass NPM_REGISTRY from environment to build args
- .env.example: Added NPM_REGISTRY configuration with usage examples

**Usage:**
Set NPM_REGISTRY in .env file or as environment variable:
- Nexus: http://nexus.company.com:8081/repository/npm-proxy/
- Artifactory: https://artifactory.company.com/artifactory/api/npm/npm-remote/
- Verdaccio: http://localhost:4873/
- Default: Leave blank for https://registry.npmjs.org/

**Example:**
```bash
NPM_REGISTRY=http://your-npm-proxy:8081/repository/npm-proxy/ ./quickstart.sh
```

Defaults to official npm registry if not specified.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-15 11:53:34 -05:00
parent d69c209101
commit 0e5abbbece
3 changed files with 15 additions and 0 deletions

View File

@@ -27,3 +27,8 @@ MINIO_SECURE=false
API_HOST=0.0.0.0 API_HOST=0.0.0.0
API_PORT=8000 API_PORT=8000
MAX_UPLOAD_SIZE=524288000 MAX_UPLOAD_SIZE=524288000
# NPM Configuration (for frontend build)
# Leave blank or set to https://registry.npmjs.org/ for default npm registry
# Set to your custom npm proxy/registry URL if needed (e.g., http://your-nexus-server:8081/repository/npm-proxy/)
NPM_REGISTRY=

View File

@@ -1,11 +1,19 @@
# Multi-stage build for Angular frontend # Multi-stage build for Angular frontend
FROM node:24-alpine AS build FROM node:24-alpine AS build
# Accept npm registry as build argument
ARG NPM_REGISTRY=https://registry.npmjs.org/
WORKDIR /app WORKDIR /app
# Copy package files # Copy package files
COPY frontend/package*.json ./ COPY frontend/package*.json ./
# Configure npm registry if custom one is provided
RUN if [ "$NPM_REGISTRY" != "https://registry.npmjs.org/" ]; then \
npm config set registry "$NPM_REGISTRY"; \
fi
# Install dependencies # Install dependencies
RUN npm ci RUN npm ci

View File

@@ -61,6 +61,8 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile.frontend dockerfile: Dockerfile.frontend
args:
NPM_REGISTRY: ${NPM_REGISTRY:-https://registry.npmjs.org/}
ports: ports:
- "80:80" - "80:80"
depends_on: depends_on: