FROM openshift/golang-builder:1.12 AS builder
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=2 OS_GIT_PATCH=24 OS_GIT_VERSION=4.2.24-202003161048-c8633ae OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=c8633ae9973bf7a6cb61dd00cb5558325cade8ac SOURCE_GIT_TAG=golang-github-prometheus-node_exporter-4.0.0-0.100.0-115-gc8633ae SOURCE_GIT_URL=https://github.com/openshift/node_exporter SOURCE_DATE_EPOCH=1583516880 OS_GIT_COMMIT=c8633ae BUILD_VERSION=v4.2.24 BUILD_RELEASE=202003161048

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/ose-base:ubi7
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=2 OS_GIT_PATCH=24 OS_GIT_VERSION=4.2.24-202003161048-c8633ae OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=c8633ae9973bf7a6cb61dd00cb5558325cade8ac SOURCE_GIT_TAG=golang-github-prometheus-node_exporter-4.0.0-0.100.0-115-gc8633ae SOURCE_GIT_URL=https://github.com/openshift/node_exporter SOURCE_DATE_EPOCH=1583516880 OS_GIT_COMMIT=c8633ae BUILD_VERSION=v4.2.24 BUILD_RELEASE=202003161048

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 /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" \
        maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>" \
        License="ASL 2.0" \
        vendor="Red Hat" \
        name="openshift/ose-prometheus-node-exporter" \
        com.redhat.component="golang-github-prometheus-node_exporter-container" \
        version="v4.2.24" \
        release="202003161048" \
        io.openshift.build.commit.id="c8633ae9973bf7a6cb61dd00cb5558325cade8ac" \
        io.openshift.build.source-location="https://github.com/openshift/node_exporter" \
        io.openshift.build.commit.url="https://github.com/openshift/node_exporter/commit/c8633ae9973bf7a6cb61dd00cb5558325cade8ac"

