From b1e7ed89440c9813c6c7282c4a9552ca4c1eaed4 Mon Sep 17 00:00:00 2001 From: Chai Bot Date: Thu, 25 Jun 2026 15:00:02 +0000 Subject: [PATCH] Dockerfile: Copy only build-required files in builder stage Replace the broad "COPY . ." instruction in the builder stage with targeted COPY instructions for only the files and directories that "make build" requires. This excludes documentation, CI configuration, and other files that are not needed for the build, reducing the amount of data copied into the builder image. This commit fixes OCPBUGS-92032. https://issues.redhat.com/browse/OCPBUGS-92032 * Dockerfile (builder stage): Replace "COPY . ." with specific COPY instructions for Makefile, go.mod, go.sum, .git/, cmd/, pkg/, and vendor/. Assisted-by: Chai Bot --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b4bf1d6fb..1ff638d28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,11 @@ FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.22 AS builder WORKDIR /go/src/github.com/openshift/route-controller-manager -COPY . . +COPY Makefile ./ +COPY go.mod go.sum ./ +COPY .git/ .git/ +COPY cmd/ cmd/ +COPY pkg/ pkg/ +COPY vendor/ vendor/ RUN make build --warn-undefined-variables FROM registry.ci.openshift.org/ocp/4.22:base-rhel9