Add NPM_REGISTRY build arg support in Dockerfile

- Accept NPM_REGISTRY ARG in frontend build stage
- Configure npm registry before install if provided
- Add build-arg to MR build stage in CI

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-05 17:58:12 -06:00
parent a6b1cca898
commit ce1dd760c4
2 changed files with 8 additions and 1 deletions

View File

@@ -40,10 +40,12 @@ build:
script:
- |
buildah build \
--build-arg NPM_REGISTRY=https://deps.global.bsf.tools/artifactory/api/npm/registry.npmjs.org/ \
--tag ${IMAGE_NAME}:${CI_COMMIT_SHORT_SHA} \
--label org.opencontainers.image.source=${CI_PROJECT_URL} \
--label org.opencontainers.image.revision=${CI_COMMIT_SHA} \
--label org.opencontainers.image.created=$(date -u +%Y-%m-%dT%H:%M:%SZ) .
--label org.opencontainers.image.created=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
.
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"

View File

@@ -1,8 +1,13 @@
# Frontend build stage
FROM node:20-alpine AS frontend-builder
ARG NPM_REGISTRY
WORKDIR /app/frontend
# Configure npm registry if provided
RUN if [ -n "$NPM_REGISTRY" ]; then npm config set registry "$NPM_REGISTRY"; fi
# Copy package files
COPY frontend/package*.json ./
RUN npm install