FROM openshift/golang-builder@sha256:ab1bfcb9d06b339cb767acb804e6aa82eb23cd0795e6f82af54e92c312a32777 AS builder
ENV __doozer=update BUILD_RELEASE=202201261123.p0.g212d80b.assembly.stream BUILD_VERSION=v4.7.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=7 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.7.0-202201261123.p0.g212d80b.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=212d80b OS_GIT_VERSION=4.7.0-202201261123.p0.g212d80b.assembly.stream-212d80b SOURCE_DATE_EPOCH=1612469994 SOURCE_GIT_COMMIT=212d80b4bd35fc6f19ec9ec537d0261a2a300cfd SOURCE_GIT_TAG=v0.2.0-282-g212d80b4 SOURCE_GIT_URL=https://github.com/openshift/k8s-prometheus-adapter 

COPY . /go/src/github.com/directxman12/k8s-prometheus-adapter

WORKDIR /go/src/github.com/directxman12/k8s-prometheus-adapter
ENV GOFLAGS="-mod=vendor"
RUN make
RUN mv /go/src/github.com/directxman12/k8s-prometheus-adapter/_output/$(go env GOARCH)/adapter /usr/bin/cm-adapter


FROM openshift/ose-base:v4.7.0.20220126.114749
ENV __doozer=update BUILD_RELEASE=202201261123.p0.g212d80b.assembly.stream BUILD_VERSION=v4.7.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=7 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.7.0-202201261123.p0.g212d80b.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=212d80b OS_GIT_VERSION=4.7.0-202201261123.p0.g212d80b.assembly.stream-212d80b SOURCE_DATE_EPOCH=1612469994 SOURCE_GIT_COMMIT=212d80b4bd35fc6f19ec9ec537d0261a2a300cfd SOURCE_GIT_TAG=v0.2.0-282-g212d80b4 SOURCE_GIT_URL=https://github.com/openshift/k8s-prometheus-adapter 

COPY --from=builder /usr/bin/cm-adapter /usr/bin/cm-adapter
    

USER 1001

ENTRYPOINT ["/usr/bin/cm-adapter"]

LABEL \
        io.k8s.display-name="OpenShift Prometheus Custom Metrics Adapter" \
        io.k8s.description="This is a component of OpenShift Container Platform that provides the Kubernetes custom metrics API based on Prometheus metrics" \
        io.openshift.tags="openshift" \
        summary="This is a component of OpenShift Container Platform that provides the Kubernetes custom metrics API based on Prometheus metrics" \
        maintainer="OpenShift Monitoring Team <team-monitoring@redhat.com>" \
        name="openshift/ose-k8s-prometheus-adapter" \
        com.redhat.component="ose-prometheus-adapter-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Monitoring" \
        release="202201261123.p0.g212d80b.assembly.stream" \
        io.openshift.build.commit.id="212d80b4bd35fc6f19ec9ec537d0261a2a300cfd" \
        io.openshift.build.source-location="https://github.com/openshift/k8s-prometheus-adapter" \
        io.openshift.build.commit.url="https://github.com/openshift/k8s-prometheus-adapter/commit/212d80b4bd35fc6f19ec9ec537d0261a2a300cfd" \
        version="v4.7.0"

