Avoid clobbering RPMDB in final container
ContainerImages/collectd/pipeline/head This commit looks good
Details
ContainerImages/collectd/pipeline/head This commit looks good
Details
Installing the RPMs in an alternate root and then copying the contents of that root to the final container rootfs overwrites the RPM database in the latter with the one from the former. This isn't necessarily a problem per se, but it makes troubleshooting difficult. To avoid this, we can install the RPMs directly in the final filesystem, which mutates the RPMDB without overwriting it.main
parent
18e3214424
commit
9ef70b2969
|
@ -9,7 +9,7 @@ RUN --mount=type=cache,target=/var/cache \
|
|||
RUN --mount=type=cache,target=/var/cache \
|
||||
dnf install -y \
|
||||
--downloadonly \
|
||||
--downloaddir=/var/cache/rpms \
|
||||
--downloaddir=/rpms \
|
||||
--setopt=install_weak_deps=0 \
|
||||
collectd \
|
||||
collectd-chrony \
|
||||
|
@ -19,21 +19,22 @@ RUN --mount=type=cache,target=/var/cache \
|
|||
collectd-write_prometheus \
|
||||
&& :
|
||||
|
||||
RUN --mount=type=cache,target=/var/cache \
|
||||
rpm -ivh -f --nodeps --root=/sysroot \
|
||||
/var/cache/rpms/collectd*.rpm \
|
||||
/var/cache/rpms/lm_sensors-libs-*.rpm \
|
||||
/var/cache/rpms/libmicrohttpd-*.rpm \
|
||||
/var/cache/rpms/libmnl-*.rpm \
|
||||
/var/cache/rpms/protobuf-c-*.rpm \
|
||||
&& cd /sysroot \
|
||||
&& rpm2cpio /var/cache/rpms/nut-client-*.rpm \
|
||||
| cpio -i './usr/lib*/libupsclient.so.6*' \
|
||||
&& :
|
||||
|
||||
|
||||
FROM registry.fedoraproject.org/fedora-minimal:40
|
||||
|
||||
COPY --from=build /sysroot /
|
||||
RUN --mount=type=cache,target=/var/cache \
|
||||
--mount=type=bind,from=build,source=/rpms,target=/rpms \
|
||||
microdnf install -y \
|
||||
--setopt=install_weak_deps=0 \
|
||||
cpio \
|
||||
&& rpm -ivh -f --nodeps \
|
||||
/rpms/collectd*.rpm \
|
||||
/rpms/lm_sensors-libs-*.rpm \
|
||||
/rpms/libmicrohttpd-*.rpm \
|
||||
/rpms/libmnl-*.rpm \
|
||||
/rpms/protobuf-c-*.rpm \
|
||||
&& rpm2cpio /rpms/nut-client-*.rpm \
|
||||
| cpio -i './usr/lib*/libupsclient.so.6*' \
|
||||
&& :
|
||||
|
||||
ENTRYPOINT ["/usr/sbin/collectd", "-f"]
|
||||
|
|
Loading…
Reference in New Issue