## # Dockerfile for building an instrumented image for e2e test code coverage collection. # This image contains the application code instrumented with Istanbul for V8 coverage. # # Usage: # docker build -f Dockerfile.instrumented -t konflux-ui:instrumented . # # The instrumented application exposes coverage data via window.__coverage__ which # can be collected by Cypress tests using @cypress/code-coverage plugin. ## FROM registry.access.redhat.com/ubi9/nodejs-24@sha256:0067c15398ece743e462637c8581b1b31027a7a2d3112e610ad700bde3b03f1b AS builder # Run as root in builder stage (final image uses non-root USER 1001) USER 0 WORKDIR /opt/app-root/src # Copy bundled Yarn Berry (no corepack needed - avoids ESM compatibility issues) COPY .yarn/releases .yarn/releases COPY .yarnrc.yml .yarnrc.yml COPY package.json package.json COPY yarn.lock yarn.lock # Create yarn wrapper script to enable 'yarn' command # This delegates to the bundled, version-controlled yarn binary RUN printf '#!/bin/sh\nexec node /opt/app-root/src/.yarn/releases/yarn-4.12.0.cjs "$@"\n' > /usr/local/bin/yarn && \ chmod +x /usr/local/bin/yarn # Copy source files COPY @types @types COPY public public COPY src src COPY tsconfig.json tsconfig.json COPY webpack.config.js webpack.config.js COPY webpack.instrumented.config.js webpack.instrumented.config.js COPY webpack.prod.config.js webpack.prod.config.js COPY aliases.config.js aliases.config.js # Note: .swcrc is not needed for instrumented build as we use babel-loader # Install dependencies and build instrumented version using yarn command RUN yarn install --immutable RUN yarn build:instrumented FROM registry.access.redhat.com/ubi9/nginx-120@sha256:f7bc7475d6da52bea1d6e239574ac9be6da1001df2363af7ab1a4095a5cd5c02 COPY --from=builder /opt/app-root/src/dist/* /opt/app-root/src/ USER 0 # Disable IPv6 since it's not enabled on all systems RUN sed -i '/\s*listen\s*\[::\]:8080 default_server;/d' /etc/nginx/nginx.conf USER 1001 # Label to identify this as an instrumented image LABEL io.konflux.coverage.instrumented="true" \ io.konflux.coverage.provider="istanbul-v8" CMD ["nginx", "-g", "daemon off;"]