Skip to content

Commit 96f6375

Browse files
chore(images): refresh base packages with microdnf update during build
Run 'microdnf update -y --nodocs' before installing additional packages in every component Dockerfile that derives from a UBI base, mirroring what we already do in image-pgadmin. This guarantees the resulting image picks up RHEL Z-stream errata that landed after ubi-minimal was last republished, instead of inheriting whatever vulnerable versions happened to be baked into the parent layer. Files updated: * components/image-collector/Dockerfile * components/image-pgbackrest/Dockerfile * components/image-pgbouncer/Dockerfile * components/image-postgres/Dockerfile.postgres * components/image-postgres/Dockerfile.postgres-upgrade * components/image-postgres/Dockerfile.postgis This matches the equivalent change already present in the internal Crunchy build of these images. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ff75ac8 commit 96f6375

6 files changed

Lines changed: 17 additions & 1 deletion

File tree

components/image-collector/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ FROM registry.access.redhat.com/ubi9/ubi-minimal
3434
COPY --from=build --chmod=0777 /otelcol-contrib /otelcol-contrib
3535
COPY --from=build /licenses /licenses
3636

37-
RUN microdnf install -y 'logrotate' 'procps-ng'
37+
RUN microdnf update -y --nodocs \
38+
&& microdnf install -y 'logrotate' 'procps-ng'
3839

3940
USER 2

components/image-pgbackrest/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ RUN rpm -ivh \
3838
# Delete the repo file as it is large and unneeded.
3939
ARG PGBACKREST_VERSION
4040
RUN rpm -ivh "https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-$(arch)/pgdg-redhat-repo-latest.noarch.rpm" \
41+
&& microdnf update -y --nodocs \
4142
&& microdnf install -y --nodocs --setopt install_weak_deps=0 'shadow-utils' \
4243
&& groupadd --gid 26 postgres \
4344
&& useradd --gid 26 --uid 26 --no-log-init postgres \

components/image-pgbouncer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ARG PGBOUNCER_VERSION=1.24.1
88

99
# The c-ares package is in the rhel-9-for-$(arch)-baseos-rpms repo, so we must enable it
1010
RUN rpm -ivh "https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-$(arch)/pgdg-redhat-repo-latest.noarch.rpm" \
11+
&& microdnf update -y --nodocs \
1112
&& microdnf install -y --nodocs --setopt install_weak_deps=0 \
1213
--enablerepo="rhel-9-for-$(arch)-baseos-rpms" \
1314
"pgbouncer-${PGBOUNCER_VERSION}" \

components/image-postgres/Dockerfile.postgis

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ rpm -ivh "https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-$(arch)/pg
2626
# Disable module to avoid conflicts
2727
microdnf --assumeyes module disable postgresql || true
2828

29+
# Refresh base packages so any CVE patches that landed in the upstream
30+
# repos after the parent crunchy-postgres image was built are picked up.
31+
microdnf update -y --nodocs
32+
2933
microdnf install -y --nodocs --setopt install_weak_deps=0 \
3034
--enablerepo="codeready-builder-for-rhel-9-$(arch)-rpms" \
3135
perl \

components/image-postgres/Dockerfile.postgres

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ rpm -ivh "https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
3232
# Disable the built-in PostgreSQL module to avoid conflicts with PGDG packages
3333
microdnf --assumeyes module disable postgresql || true
3434

35+
# Refresh all base-image packages against the current RHEL/EPEL/PGDG repos so
36+
# the build picks up CVE patches that landed after ubi-minimal was last
37+
# republished.
38+
microdnf update -y --nodocs
39+
3540
# Ensure complete timezone database is present (some minimal UBI layers
3641
# can have tzdata partially pruned); reinstall guarantees fresh /usr/share/zoneinfo
3742
microdnf reinstall -y --nodocs 'tzdata'

components/image-postgres/Dockerfile.postgres-upgrade

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ rpm -ivh "https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-$(arch)/pg
1818
# Disable module to avoid conflicts
1919
microdnf --assumeyes module disable postgresql || true
2020

21+
# Refresh base packages so any CVE patches that landed in the upstream
22+
# repos after the parent crunchy-postgres image was built are picked up.
23+
microdnf update -y --nodocs
24+
2125
# Build package list for all target versions
2226
PKGS="$(for POSTGRES_VERSION in ${POSTGRES_UPGRADE_VERSIONS}; do
2327
POSTGRES_MAJOR_VERSION="${POSTGRES_VERSION%.*}"

0 commit comments

Comments
 (0)