Files
warehouse13/Dockerfile.frontend
Mondo Diaz 5fdefecbd0 Downgrade to Angular 19 and add custom npm registry package-lock regeneration
**Angular Downgrade:**
- Downgraded from Angular 20 to Angular 19 for better stability
- Updated all @angular/* packages to ^19.0.0
- Adjusted TypeScript to ~5.8.0 for Angular 19 compatibility
- Added required outputPath and index to angular.json for Angular 19 build requirements
- Verified production build works successfully

**NPM Registry Enhancements:**
- Updated Dockerfile.frontend to regenerate package-lock.json when custom npm registry is provided
- When NPM_REGISTRY is set to custom URL, the build will:
  1. Configure npm to use the custom registry
  2. Delete existing package-lock.json
  3. Generate new package-lock.json with custom registry URLs
  4. Run npm ci with the new lock file
- Default behavior (npmjs.org) unchanged - uses existing package-lock.json

**Build Verification:**
- Local build tested: ✓
- Docker build tested: ✓
- Bundle size: 348.75 kB raw, 91.73 kB gzipped
- No vulnerabilities found

**Usage:**
```bash
# Default registry (uses existing package-lock.json)
./quickstart.sh

# Custom registry (regenerates package-lock.json)
NPM_REGISTRY=http://your-npm-proxy:8081/repository/npm-proxy/ ./quickstart.sh
```

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 12:03:42 -05:00

41 lines
983 B
Docker

# Multi-stage build for Angular frontend
FROM node:24-alpine AS build
# Accept npm registry as build argument
ARG NPM_REGISTRY=https://registry.npmjs.org/
WORKDIR /app
# Copy package files
COPY frontend/package*.json ./
# Configure npm registry and regenerate package-lock.json if custom registry is provided
RUN if [ "$NPM_REGISTRY" != "https://registry.npmjs.org/" ]; then \
echo "Using custom npm registry: $NPM_REGISTRY"; \
npm config set registry "$NPM_REGISTRY"; \
rm -f package-lock.json; \
npm install --package-lock-only; \
fi
# Install dependencies
RUN npm ci
# Copy source code
COPY frontend/ ./
# Build for production
RUN npm run build:prod
# Final stage - nginx to serve static files
FROM nginx:alpine
# Copy built Angular app to nginx
COPY --from=build /app/dist/frontend/browser /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]