FROM openshift/golang-builder:1.12 AS builder
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=10 OS_GIT_VERSION=4.3.10-202003311428-3d1c61e OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=3d1c61e9a783d8c4a764b130837682fa9ab8e9df SOURCE_GIT_TAG=v0.2.0-203-g3d1c61e SOURCE_GIT_URL=https://github.com/openshift/k8s-prometheus-adapter SOURCE_DATE_EPOCH=1572514529 OS_GIT_COMMIT=3d1c61e BUILD_VERSION=v4.3.10 BUILD_RELEASE=202003311428

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.3.10.20200331.142813
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=10 OS_GIT_VERSION=4.3.10-202003311428-3d1c61e OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=3d1c61e9a783d8c4a764b130837682fa9ab8e9df SOURCE_GIT_TAG=v0.2.0-203-g3d1c61e SOURCE_GIT_URL=https://github.com/openshift/k8s-prometheus-adapter SOURCE_DATE_EPOCH=1572514529 OS_GIT_COMMIT=3d1c61e BUILD_VERSION=v4.3.10 BUILD_RELEASE=202003311428

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" \
        maintainer="Solly Ross <sross@redhat.com>" \
        name="openshift/ose-k8s-prometheus-adapter" \
        com.redhat.component="ose-prometheus-adapter-container" \
        version="v4.3.10" \
        release="202003311428" \
        io.openshift.build.commit.id="3d1c61e9a783d8c4a764b130837682fa9ab8e9df" \
        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/3d1c61e9a783d8c4a764b130837682fa9ab8e9df"

