Migrate cp-kafka-rest to UBI9 micro base image#131
Migrate cp-kafka-rest to UBI9 micro base image#131Krish Vora (KrishVora01) wants to merge 1 commit intomasterfrom
Conversation
Switch from single-stage cp-base-java to 3-stage multi-stage build using cp-base-java-micro: - Stage 1: Extract package_dedupe tool from cp-base-java-micro - Stage 2: Install confluent-kafka-rest, confluent-telemetry, confluent-security RPMs into /microdir using dnf --installroot - Stage 3: Selectively COPY to cp-base-java-micro final image Key changes: - Base image: cp-base-java -> cp-base-java-micro - Package manager: microdnf -> dnf --installroot=/microdir - User: appuser hardcoded -> ${APP_UID}/${APP_GID} variables - COPY: --chown=appuser:appuser -> separate RUN chown - Remove unused confluent-security subdirs (schema-registry, connect, ksql) - Remove user database files to preserve base image's appuser - Consolidate /usr/bin/ COPYs into single layer for RedHat cert (<40 layers) - Add UBI9_VERSION build arg to pom.xml for both spotify and fabric8 plugins Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95c34b7 to
4f596c5
Compare
There was a problem hiding this comment.
Pull request overview
Migrates the cp-kafka-rest image build to a UBI9-based multi-stage approach to reduce final image size by installing RPMs into an installroot and selectively copying artifacts into a cp-base-java-micro final image.
Changes:
- Convert
kafka-rest/Dockerfile.ubi9from single-stagecp-base-javato a 3-stage build (tools → builder → final) usingcp-base-java-micro. - Install
confluent-kafka-rest,confluent-telemetry, andconfluent-securityinto/microdir, remove unused security subdirs, and dedupe jars before copying into the final image. - Pass
UBI9_VERSIONas a Docker build arg via both spotify and fabric8 Maven Docker plugins.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| kafka-rest/pom.xml | Adds UBI9_VERSION build-arg wiring for spotify + fabric8 Docker build plugins. |
| kafka-rest/Dockerfile.ubi9 | Implements multi-stage UBI9 builder installroot flow and switches final image to cp-base-java-micro with selective copies and UID/GID-based ownership. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ARG UBI9_VERSION | ||
|
|
||
| FROM ${DOCKER_UPSTREAM_REGISTRY}confluentinc/cp-base-java:${DOCKER_UPSTREAM_TAG} | ||
| # Stage 1: Get package_dedupe tool from base image | ||
| FROM ${DOCKER_UPSTREAM_REGISTRY}confluentinc/cp-base-java-micro:${DOCKER_UPSTREAM_TAG} AS tools | ||
|
|
||
| # Stage 2: Install packages using ubi9 with dnf to /microdir | ||
| FROM registry.access.redhat.com/ubi9:${UBI9_VERSION} AS builder | ||
|
|
There was a problem hiding this comment.
UBI9_VERSION is used in the FROM registry.access.redhat.com/ubi9:${UBI9_VERSION} instruction but the ARG UBI9_VERSION has no default. If the build arg isn’t provided (e.g., local docker build), the build will fail due to an invalid base image reference. Consider providing a safe default (or switching to a pinned default) and/or documenting/enforcing the required build arg in the build tooling.
Summary
cp-base-javato 3-stage multi-stage build usingcp-base-java-micropackage_dedupetool fromcp-base-java-microconfluent-kafka-rest,confluent-telemetry,confluent-securityRPMs into/microdirusingdnf --installrootcp-base-java-microfinal imageconfluent-securitysubdirs (schema-registry, connect, ksql)appuserhardcoded ->${APP_UID}/${APP_GID}variablesUBI9_VERSIONbuild arg to pom.xml for both spotify and fabric8 pluginsTest plan
./run-kind-e2e-kafka-rest.sh🤖 Generated with Claude Code