FROM registry.redhat.io/ubi9/ubi-minimal:latest

USER 0

COPY entrypoint-psacct.sh /usr/local/bin/entrypoint.sh

# This still applies: delete host RHSM data in OpenShift
# Twist: if there is no host entitlement, remove host RHSM data.
RUN [ -d /etc/pki/entitlement-host ] || rm -f /etc/rhsm-host ; \
    microdnf -y install psacct && \
    rm -rf /var/lib/dnf /var/cache/dnf /var/cache/yum /var/cache/cups /var/cache/PackageKit && \
    chmod 755 /usr/local/bin/entrypoint.sh

VOLUME /var/account

ARG STARTUP_SCRATCH
ARG CUMULATIVE

LABEL description="Minimal psacct collector sidecar image" \
	io.k8s.description="Minimal psacct collector sidecar image" \
	io.k8s.display-name="psacct collector" \
	io.openshift.expose-services="" \
	maintainer="Grega Bremec <gregab@p0f.net>" \
	vendor="P0F" \
	version="v1.0" \
	release="1.0" \
	License=BSD

ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]