-
Notifications
You must be signed in to change notification settings - Fork 172
ROX-30858: Migrate main image to ubi-micro #17406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e95cff5
e96429d
2e1cb0c
cbe714d
fdd7b3f
b217d21
c4b4bc6
9a98e0c
094811c
664251b
26b876b
753ce9e
56f4c69
b30c520
505607e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,47 @@ RUN mkdir -p image/rhel/docs/api/v1 && \ | |
| RUN make copy-go-binaries-to-image-dir | ||
|
|
||
|
|
||
| FROM registry.access.redhat.com/ubi9/ubi-micro:latest@sha256:093a704be0eaef9bb52d9bc0219c67ee9db13c2e797da400ddb5d5ae6849fa10 AS ubi-micro-base | ||
|
|
||
| FROM registry.access.redhat.com/ubi9/ubi:latest@sha256:6ed9f6f637fe731d93ec60c065dbced79273f1e0b5f512951f2c0b0baedb16ad AS package_installer | ||
|
|
||
| ARG PG_VERSION | ||
|
|
||
| # Copy ubi-micro base to preserve rpmdb | ||
| COPY --from=ubi-micro-base / /out/ | ||
|
|
||
| # Install packages directly to /out/ using --installroot | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor nitpick, but... This comment is present in I suggest you stick with one way of doing things and do it consistently in this PR and in other ongoing PRs. |
||
| # Note: --setopt=reposdir=/etc/yum.repos.d instructs dnf to use repo configurations pointing to RPMs | ||
| # prefetched by Hermeto/Cachi2, instead of installroot's default UBI repos. | ||
| RUN dnf module enable -y \ | ||
| --installroot=/out/ \ | ||
| --setopt=reposdir=/etc/yum.repos.d \ | ||
| --releasever=9 \ | ||
| postgresql:${PG_VERSION} && \ | ||
| dnf install -y \ | ||
| --installroot=/out/ \ | ||
| --setopt=reposdir=/etc/yum.repos.d \ | ||
| --releasever=9 \ | ||
| --setopt=install_weak_deps=0 \ | ||
| --nodocs \ | ||
| ca-certificates \ | ||
| findutils \ | ||
| openssl \ | ||
| postgresql \ | ||
| util-linux && \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's with |
||
| dnf --installroot=/out/ clean all && \ | ||
| rm -rf /out/var/cache/dnf /out/var/cache/yum | ||
|
|
||
| # Setup stackrox directories with correct ownership | ||
| RUN mkdir -p /out/stackrox && \ | ||
| mkdir -p /out/etc/pki/ca-trust/source/anchors /out/etc/ssl && \ | ||
| mkdir -p /out/var/lib/stackrox /out/var/log/stackrox /out/var/cache/stackrox && \ | ||
| chown -R 4000:4000 /out/etc/pki/ca-trust /out/etc/ssl /out/var/lib/stackrox /out/var/log/stackrox /out/var/cache/stackrox /out/tmp | ||
|
Comment on lines
+72
to
+75
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look what a mess we have here. I think, committing suggestions from GitHub UI is not safe for the time being. |
||
|
|
||
| COPY --from=go-builder /go/src/github.com/stackrox/rox/app/image/rhel/static-bin/* /out/stackrox/ | ||
| RUN chroot /out /stackrox/save-dir-contents /etc/pki/ca-trust /etc/ssl | ||
|
Comment on lines
+77
to
+78
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be copied and executed (without
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My idea was to not add unnecessary layers in the final image
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to worry about layers in the Konflux image. They get all squashed. You also don't need to worry about layers in the GHA-built image, we did not attempt to reduce them historically. |
||
|
|
||
|
|
||
| FROM registry.access.redhat.com/ubi9/nodejs-20:latest@sha256:ad30ca76c555dafd2c0c772f8a12aae41cadc767c9654761c6fb706fd1659920 AS ui-builder | ||
|
|
||
| WORKDIR /go/src/github.com/stackrox/rox/app | ||
|
|
@@ -59,15 +100,9 @@ ENV UI_PKG_INSTALL_EXTRA_ARGS="--ignore-scripts" | |
| RUN make -C ui build | ||
|
|
||
|
|
||
| FROM registry.access.redhat.com/ubi9/ubi-minimal:latest@sha256:69f5c9886ecb19b23e88275a5cd904c47dd982dfa370fbbd0c356d7b1047ef68 | ||
|
|
||
| ARG PG_VERSION | ||
| FROM registry.access.redhat.com/ubi9/ubi-micro:latest@sha256:093a704be0eaef9bb52d9bc0219c67ee9db13c2e797da400ddb5d5ae6849fa10 | ||
|
|
||
| RUN microdnf -y module enable postgresql:${PG_VERSION} && \ | ||
| microdnf -y install postgresql && \ | ||
| microdnf -y clean all && \ | ||
| rpm --verbose -e --nodeps $(rpm -qa curl '*rpm*' '*dnf*' '*libsolv*' '*hawkey*' 'yum*') && \ | ||
| rm -rf /var/cache/dnf /var/cache/yum | ||
| COPY --from=package_installer /out/ / | ||
|
|
||
| COPY --from=ui-builder /go/src/github.com/stackrox/rox/app/ui/build /ui/ | ||
|
|
||
|
|
@@ -80,7 +115,6 @@ COPY --from=go-builder /go/src/github.com/stackrox/rox/app/image/rhel/bin/sensor | |
| COPY --from=go-builder /go/src/github.com/stackrox/rox/app/image/rhel/bin/admission-control /stackrox/bin/ | ||
| COPY --from=go-builder /go/src/github.com/stackrox/rox/app/image/rhel/bin/config-controller /stackrox/bin/ | ||
| COPY --from=go-builder /go/src/github.com/stackrox/rox/app/image/rhel/bin/roxagent /stackrox/bin/ | ||
| COPY --from=go-builder /go/src/github.com/stackrox/rox/app/image/rhel/static-bin/* /stackrox/ | ||
| RUN GOARCH=$(uname -m) ; \ | ||
| case $GOARCH in x86_64) GOARCH=amd64 ;; aarch64) GOARCH=arm64 ;; esac ; \ | ||
| ln -s /assets/downloads/cli/roxctl-linux-$GOARCH /stackrox/roxctl ; \ | ||
|
|
@@ -123,11 +157,4 @@ COPY --from=go-builder /go/src/github.com/stackrox/rox/app/image/rhel/docs/api/v | |
|
|
||
| COPY LICENSE /licenses/LICENSE | ||
|
|
||
| # The following paths are written to in Central. | ||
| RUN chown -R 4000:4000 /etc/pki/ca-trust && save-dir-contents /etc/pki/ca-trust/source && \ | ||
| mkdir -p /var/lib/stackrox && chown -R 4000:4000 /var/lib/stackrox && \ | ||
| mkdir -p /var/log/stackrox && chown -R 4000:4000 /var/log/stackrox && \ | ||
| mkdir -p /var/cache/stackrox && chown -R 4000:4000 /var/cache/stackrox && \ | ||
| chown -R 4000:4000 /tmp | ||
|
|
||
| USER 4000:4000 | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old content was:
/stackrox, here you added/out/stackrox. Is this really needed now? I believeCOPYcommand would happily create missing directories for you./etc/pki/ca-trustalready exists, here you create/out/etc/pki/ca-trust/source/anchors. Why, did something fail without it?/etc/sslv.s. new/out/etc/ssl.save-dir-contentsand it's lost in the new version.The same applies to the similar part of
konflux.Dockerfile.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to make it similar to konflux dockerfile