deploy: switch runtime to Red Hat Hardened core-runtime image#821
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Containerfile is refactored into a multi-stage build: the builder stage now explicitly uses strict Bash options and improves Pulumi CLI extraction; plugin installation is configured with a dedicated PULUMI_HOME directory and prepended PATH; the new runtime stage uses a lightweight hi/core-runtime base image, copies preinstalled plugins, and switches to a non-root user. ChangesContainer Multi-Stage Build Optimization
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
00d6227 to
a289bc4
Compare
a289bc4 to
4fb3e51
Compare
Multi-stage build: move Pulumi plugin installation from runtime to build stage, then copy binaries + plugins into hi/core-runtime (58 MB glibc base, minimal CVE surface). Runtime only needs the compiled mapt binary, pulumi CLI, and pre-installed plugins — no Go toolchain or package manager needed.
4fb3e51 to
1b10956
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
oci/Containerfile (1)
61-69: ARCH_N looks unused in this repo; remove or derive fromTARGETARCHonly ifmaptneeds it
ARCH_Nis only defined inoci/Containerfile(ENV ... ARCH_N=x86_64) and there are no other in-repo (non-vendor) consumers ofARCH_N. Either drop the env var from the runtime stage, or switch to aTARGETARCH-derived value if themaptbinary contract requires it.🤖 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 `@oci/Containerfile` around lines 61 - 69, The ENV variable ARCH_N is unused; either remove it from the runtime Containerfile stage or derive it from the build ARG TARGETARCH if the mapt binary requires an architecture-specific value. Locate the ENV line setting "ARCH_N=x86_64" and either delete that token from the ENV block or replace it with a TARGETARCH-derived assignment (e.g., map TARGETARCH values to the expected ARCH_N value) so the runtime image only exposes ARCH_N when genuinely required by mapt or other runtime components.
🤖 Prompt for all review comments with 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.
Inline comments:
In `@oci/Containerfile`:
- Line 66: The Dockerfile/Containerfile currently bakes the Pulumi passphrase
into image metadata via the ENV PULUMI_CONFIG_PASSPHRASE declaration; remove
this ENV line and stop hardcoding the secret, and instead inject the passphrase
at runtime from a secret store or orchestration secret (e.g., environment
secret, Kubernetes Secret, Docker secret, or a managed Pulumi secrets provider).
Specifically, delete or comment out the ENV PULUMI_CONFIG_PASSPHRASE
"passphrase" entry and ensure your runtime startup/entrypoint logic (where
Pulumi is invoked) reads PULUMI_CONFIG_PASSPHRASE from the environment provided
by the orchestrator or a mounted secret, or switch to a managed Pulumi secrets
provider and update the Pulumi client initialization accordingly.
- Around line 18-19: The Pulumi archive is downloaded and immediately extracted
(curl -> pulumicli.tar.gz then tar -xzvf) without integrity verification; update
the Dockerfile steps around the PULUMI_URL download to also fetch or use a
trusted checksum/signature (e.g., ${PULUMI_URL}.sha256 or an env var
PULUMI_SHA256 / PULUMI_ASC), verify the downloaded pulumicli.tar.gz with
sha256sum or signature verification and fail the build if verification fails,
then proceed to tar -xzvf only after successful verification; apply the same
change to the other asset download/extract sequence at the other occurrence
(lines with tar -xzvf for the second asset).
---
Nitpick comments:
In `@oci/Containerfile`:
- Around line 61-69: The ENV variable ARCH_N is unused; either remove it from
the runtime Containerfile stage or derive it from the build ARG TARGETARCH if
the mapt binary requires an architecture-specific value. Locate the ENV line
setting "ARCH_N=x86_64" and either delete that token from the ENV block or
replace it with a TARGETARCH-derived assignment (e.g., map TARGETARCH values to
the expected ARCH_N value) so the runtime image only exposes ARCH_N when
genuinely required by mapt or other runtime components.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 36a45a44-1761-4052-9d53-481eb53341fd
📒 Files selected for processing (1)
oci/Containerfile
Summary
ubi9/ubi(230 MB) tohi/core-runtime(58 MB) — a distroless-like image with minimal CVE surfaceChanges
oci/Containerfile— multi-stage build with plugin install in build stage, pinnedhi/core-runtimedigest