Skip to content

OCPBUGS-92032: Dockerfile: Copy only build-required files in builder stage#99

Open
Miciah wants to merge 1 commit into
openshift:mainfrom
redhat-chai-bot:fix/dockerfile-specific-copy
Open

OCPBUGS-92032: Dockerfile: Copy only build-required files in builder stage#99
Miciah wants to merge 1 commit into
openshift:mainfrom
redhat-chai-bot:fix/dockerfile-specific-copy

Conversation

@Miciah

@Miciah Miciah commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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.

Summary by CodeRabbit

  • Chores
    • Streamlined the container build process to include only the files needed for compilation.
    • Kept the final runtime image and delivered application binary unchanged.

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 <chai-bot@redhat.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jun 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@Miciah: This pull request references Jira Issue OCPBUGS-92032, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @melvinjoseph86

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

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.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 73fce04f-0ce0-486a-8bee-85a5f58ea440

📥 Commits

Reviewing files that changed from the base of the PR and between 01ccbfb and b1e7ed8.

📒 Files selected for processing (1)
  • Dockerfile

Walkthrough

The Dockerfile’s builder stage now copies selected build inputs explicitly instead of the full build context. The build command and final runtime stage remain unchanged.

Changes

Dockerfile builder stage update

Layer / File(s) Summary
Explicit builder COPY
Dockerfile
The builder stage replaces COPY . . with explicit copies of Makefile, go.mod, go.sum, .git, cmd/, pkg/, and vendor/.

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main Dockerfile builder-stage copy change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo specs use dynamic titles; the only subtests use static string-literal names like tc.name/tt.name tables.
Test Structure And Quality ✅ Passed No Ginkgo test code was changed; the PR only updates Dockerfile copy instructions, so the test-quality check is not applicable.
Microshift Test Compatibility ✅ Passed Only Dockerfile changed in this commit; no Ginkgo/e2e test files or test code were added or modified, so MicroShift compatibility is not implicated.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR only changes Dockerfile COPY instructions; no Go/Ginkgo test files were added or modified, so SNO compatibility is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The PR only narrows Dockerfile COPY inputs; no deployment manifests, controllers, replicas, affinity, selectors, or topology-aware scheduling code were modified.
Ote Binary Stdout Contract ✅ Passed PASS — the PR only changes Dockerfile COPY instructions; no process-level Go code was modified, and main/suite setup shows no stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR only changes Dockerfile, .ci-operator.yaml, and go.mod; no Ginkgo e2e tests or IPv4/external-connectivity logic were added.
No-Weak-Crypto ✅ Passed Dockerfile-only change; it just narrows COPY inputs for the builder stage and adds no weak-crypto, custom-crypto, or token-compare code.
Container-Privileges ✅ Passed Only the Dockerfile changed; no non-vendor manifests contain privileged, hostPID/Network/IPC, allowPrivilegeEscalation, or SYS_ADMIN settings.
No-Sensitive-Data-In-Logs ✅ Passed Only Dockerfile COPY instructions changed; no logging code or sensitive data exposure was added.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@Miciah: This pull request references Jira Issue OCPBUGS-92032, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @melvinjoseph86

Details

In response to this:

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.

Summary by CodeRabbit

  • Chores
  • Streamlined the container build process to include only the files needed for compilation.
  • Kept the final runtime image and delivered application binary unchanged.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@Miciah: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp b1e7ed8 link true /test e2e-gcp

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants