FROM openshift/golang-builder:rhel_8_golang_1.16 AS builder
ENV __doozer=update BUILD_RELEASE=202111020858.p0.git.1ab97f3.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202111020858.p0.git.1ab97f3.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=1ab97f3 OS_GIT_VERSION=4.9.0-202111020858.p0.git.1ab97f3.assembly.stream-1ab97f3 SOURCE_DATE_EPOCH=1626790676 SOURCE_GIT_COMMIT=1ab97f35f07cf1ed02a2b4ea3f3c3c9d09bf94b5 SOURCE_GIT_TAG=golang-github-prometheus-node_exporter-4.0.0-0.100.0-670-g1ab97f3 SOURCE_GIT_URL=https://github.com/openshift/node_exporter 

WORKDIR /go/src/github.com/prometheus/node_exporter
COPY . .
RUN if yum install -y prometheus-promu; then export BUILD_PROMU=false; fi && make build

FROM openshift/base-rhel8:v4.9.0.20211102.090836
ENV __doozer=update BUILD_RELEASE=202111020858.p0.git.1ab97f3.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202111020858.p0.git.1ab97f3.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=1ab97f3 OS_GIT_VERSION=4.9.0-202111020858.p0.git.1ab97f3.assembly.stream-1ab97f3 SOURCE_DATE_EPOCH=1626790676 SOURCE_GIT_COMMIT=1ab97f35f07cf1ed02a2b4ea3f3c3c9d09bf94b5 SOURCE_GIT_TAG=golang-github-prometheus-node_exporter-4.0.0-0.100.0-670-g1ab97f3 SOURCE_GIT_URL=https://github.com/openshift/node_exporter 

COPY --from=builder /go/src/github.com/prometheus/node_exporter/node_exporter /bin/node_exporter

RUN yum install -y virt-what && yum clean all && rm -rf /var/cache/*
COPY text_collectors/virt.sh text_collectors/boots.sh /node_exporter/collectors/init/

EXPOSE      9100
USER        nobody
ENTRYPOINT  [ "/bin/node_exporter" ]

LABEL \
        io.k8s.display-name="Node Exporter" \
        io.k8s.description="Prometheus exporter for hardware and OS metrics exposed by *NIX kernels, written in Go with pluggable metric collectors" \
        io.openshift.tags="openshift,node" \
        summary="Prometheus exporter for machine metrics" \
        maintainer="OpenShift Monitoring Team <team-monitoring@redhat.com>" \
        License="ASL 2.0" \
        vendor="Red Hat" \
        name="openshift/ose-prometheus-node-exporter" \
        com.redhat.component="golang-github-prometheus-node_exporter-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Monitoring" \
        release="202111020858.p0.git.1ab97f3.assembly.stream" \
        io.openshift.build.commit.id="1ab97f35f07cf1ed02a2b4ea3f3c3c9d09bf94b5" \
        io.openshift.build.source-location="https://github.com/openshift/node_exporter" \
        io.openshift.build.commit.url="https://github.com/openshift/node_exporter/commit/1ab97f35f07cf1ed02a2b4ea3f3c3c9d09bf94b5" \
        version="v4.9.0"

