Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-9-release-golang-1.25-openshift-4.22
tag: rhel-9-release-golang-1.26-openshift-5.0
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.22 AS builder
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 AS builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Base image source and broad context copy violate container policy.

FROM uses registry.ci.openshift.org (not catalog.redhat.com UBI/distroless), and COPY . . copies the full context instead of explicit files.

Suggested pattern
-FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 AS builder
+FROM catalog.redhat.com/ubi9/go-toolset:latest AS builder
 ...
-COPY . .
+COPY go.mod go.sum ./
+COPY cmd/ ./cmd/
+COPY pkg/ ./pkg/
+COPY vendor/ ./vendor/
 ...
-FROM registry.ci.openshift.org/ocp/5.0:base-rhel9
+FROM catalog.redhat.com/ubi9/ubi-minimal:latest

As per coding guidelines, "Base image: UBI minimal or distroless from catalog.redhat.com" and "COPY specific files, not entire context".

Also applies to: 4-4, 7-7

🧰 Tools
🪛 Trivy (0.69.3)

[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` at line 1, Change the Dockerfile's base image and context copy:
replace the FROM registry.ci.openshift.org... AS builder line with an approved
UBI/distroless base pulled from catalog.redhat.com (e.g.,
catalog.redhat.com/ubi9/... or a distroless equivalent), and stop using COPY .
.; instead, explicitly COPY only required build inputs (e.g., COPY go.mod go.sum
./ and COPY cmd/<your-binary>/ ./ or COPY specific source dirs) into the builder
stage before running go build. Ensure the stage name (AS builder) remains
consistent and update any later COPY --from=builder lines accordingly so only
produced artifacts are copied into the final image.

Source: Coding guidelines


WORKDIR /go/src/github.com/openshift/cloud-network-config-controller
COPY . .
RUN make build

FROM registry.ci.openshift.org/ocp/4.22:base-rhel9
FROM registry.ci.openshift.org/ocp/5.0:base-rhel9

COPY --from=builder /go/src/github.com/openshift/cloud-network-config-controller/_output/bin/cloud-network-config-controller /usr/bin/

Expand Down