# CI builder image for npm libraries: ci, Jest coverage, build, and pack (.tgz). # # Setup in a product repo: # 1. Copy to utils/engines/containerbuilder/{repo}-containerbuilder.Dockerfile # 2. Customize WORKDIR (package root), testScript, and build script names # 3. Reference the same dockerfile from engines/test and engines/release scriptSettings # 4. Disable host NpmJestTest / NpmBuild / NpmPack when the container owns the pipeline # # Source injection: set sourceContextPath to the folder that contains package.json (often repo src/). # Recovered paths: /artifacts (.tgz), /testResults (coverage/ for Jest json-summary). # # CollectCoverage reads recovered /testResults for QualityGate; DiscoverPackageArtifacts finds .tgz in /artifacts. FROM node:24-bookworm-slim WORKDIR /src ENV ARTIFACTS_DIR=/artifacts ENV NPM_CONFIG_FUND=false ENV NPM_CONFIG_AUDIT=false RUN mkdir -p /artifacts /testResults # Option B: COPY build/ci-npm-pack.sh /usr/local/bin/ci-npm.sh && chmod +x ... && ENTRYPOINT ["/usr/local/bin/ci-npm.sh"] ENTRYPOINT ["sh", "-c", "npm ci && npm run test:coverage -- --coverage --coverageReporters=json-summary --coverageReporters=text && cp -r coverage /testResults/ && npm run build && npm pack --pack-destination /artifacts"]