FROM openshift/golang-builder:1.10 AS builder
ENV SOURCE_GIT_COMMIT=17d5e9405c03ff0d7ffc79af56171b622f63c871 SOURCE_DATE_EPOCH=1556092164 BUILD_VERSION=v4.1.9 SOURCE_GIT_URL=https://github.com/openshift/k8s-prometheus-adapter SOURCE_GIT_TAG=v0.2.0-140-g17d5e94 BUILD_RELEASE=201907311355

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

WORKDIR /go/src/github.com/directxman12/k8s-prometheus-adapter
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.1.9.20190731.135530
ENV SOURCE_GIT_COMMIT=17d5e9405c03ff0d7ffc79af56171b622f63c871 SOURCE_DATE_EPOCH=1556092164 BUILD_VERSION=v4.1.9 SOURCE_GIT_URL=https://github.com/openshift/k8s-prometheus-adapter SOURCE_GIT_TAG=v0.2.0-140-g17d5e94 BUILD_RELEASE=201907311355

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

USER 1001

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

LABEL \
        io.k8s.description="This is a component of OpenShift Container Platform that provides the Kubernetes custom metrics API based on Prometheus metrics" \
        com.redhat.component="ose-prometheus-adapter-container" \
        maintainer="Solly Ross <sross@redhat.com>" \
        name="openshift/ose-k8s-prometheus-adapter" \
        io.k8s.display-name="OpenShift Prometheus Custom Metrics Adapter" \
        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/17d5e9405c03ff0d7ffc79af56171b622f63c871" \
        version="v4.1.9" \
        io.openshift.build.commit.id="17d5e9405c03ff0d7ffc79af56171b622f63c871" \
        release="201907311355" \
        io.openshift.tags="openshift"

