fix: migrate Dockerfile from Docker to UBI image#923
Conversation
WalkthroughSwitched the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/public-api/Dockerfile`:
- Around line 35-36: The HEALTHCHECK line uses curl but the base image
ubi-minimal does not include curl; either install curl in the image before the
HEALTHCHECK or replace the check with a built-in alternative. Fix option A: add
a step early in the Dockerfile to install curl via the image package manager
(e.g., microdnf/microdnf install -y curl and clean cache) so the existing
HEALTHCHECK CMD curl -sf http://localhost:8081/health || exit 1 will succeed.
Fix option B: remove curl from the HEALTHCHECK and switch to a non-curl health
probe (for example use a simple TCP probe or your Go binary’s internal /health
readiness flag) so the HEALTHCHECK line itself no longer depends on curl.
- Line 19: Replace the unpinned base image FROM
registry.access.redhat.com/ubi9/ubi-minimal:latest with a pinned UBI version
(e.g., registry.access.redhat.com/ubi9/ubi-minimal:9.7) and ensure the image
installs curl-minimal so the existing health check can run; update the
Dockerfile to add installation of curl-minimal (or, if you prefer not to add
packages, replace the curl-based health probe with a bash /dev/tcp check) so the
health probe no longer fails at runtime.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5d14ad28-6a0f-4dd0-9e2a-d03483db4cb2
📒 Files selected for processing (1)
components/public-api/Dockerfile
Replace golang:1.24-alpine and alpine:3.19 with registry.access.redhat.com/ubi9/go-toolset:1.24 and ubi9/ubi-minimal:latest for consistency with other components. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Martin Prpič <mprpic@redhat.com>
3d1a52c to
f87c841
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
components/public-api/Dockerfile (1)
35-36:⚠️ Potential issue | 🔴 Critical
curlis not available inubi-minimalby default — healthcheck will fail at runtime.The
ubi9/ubi-minimalimage does not includecurl. Install it or use an alternative.🐛 Option 1: Install curl-minimal
WORKDIR /app +# Install curl for healthcheck +RUN microdnf install -y curl-minimal && microdnf clean all + # Copy binary from builder COPY --from=builder /app/public-api .🐛 Option 2: Use /dev/tcp (no extra packages)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD curl -sf http://localhost:8081/health || exit 1 + CMD sh -c 'exec 3<>/dev/tcp/127.0.0.1/8081 && echo -e "GET /health HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n" >&3 && grep -q "200" <&3'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/public-api/Dockerfile` around lines 35 - 36, The HEALTHCHECK using "CMD curl -sf http://localhost:8081/health || exit 1" will fail on ubi9/ubi-minimal because curl is not present; either install a minimal curl package in the Dockerfile (e.g., add a microdnf/yum install step for curl-minimal and clean caches) so the existing HEALTHCHECK works, or replace the HEALTHCHECK command with a no-deps TCP check using the shell's /dev/tcp (modify the HEALTHCHECK/CMD invocation to use a shell -c that opens /dev/tcp localhost 8081 and checks the connection/HTTP response) and ensure the command returns proper exit codes; update the HEALTHCHECK line accordingly (reference: the HEALTHCHECK/CMD curl -sf ... entry).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@components/public-api/Dockerfile`:
- Around line 35-36: The HEALTHCHECK using "CMD curl -sf
http://localhost:8081/health || exit 1" will fail on ubi9/ubi-minimal because
curl is not present; either install a minimal curl package in the Dockerfile
(e.g., add a microdnf/yum install step for curl-minimal and clean caches) so the
existing HEALTHCHECK works, or replace the HEALTHCHECK command with a no-deps
TCP check using the shell's /dev/tcp (modify the HEALTHCHECK/CMD invocation to
use a shell -c that opens /dev/tcp localhost 8081 and checks the connection/HTTP
response) and ensure the command returns proper exit codes; update the
HEALTHCHECK line accordingly (reference: the HEALTHCHECK/CMD curl -sf ...
entry).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 37b2fb6c-ce36-449c-a829-1a0f8da5df96
📒 Files selected for processing (1)
components/public-api/Dockerfile
Merge Queue Status
This pull request spent 17 seconds in the queue, including 1 second running CI. Required conditions to merge
|
Replace golang:1.24-alpine and alpine:3.19 with
registry.access.redhat.com/ubi9/go-toolset:1.24 and ubi9/ubi-minimal:latest for consistency with other components.