FROM openshift/golang-builder:rhel_8_golang_1.15 AS builder
ENV __doozer=update BUILD_RELEASE=202101230113.p0 BUILD_VERSION=v4.6.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=6 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.6.0-202101230113.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=0163f7c OS_GIT_VERSION=4.6.0-202101230113.p0-0163f7c SOURCE_DATE_EPOCH=1608245684 SOURCE_GIT_COMMIT=0163f7c1cb7061a2f2de4c38c5e3c7f7921cb368 SOURCE_GIT_TAG=v0.3.1-140-g0163f7c1 SOURCE_GIT_URL=https://github.com/openshift/kube-rbac-proxy 
WORKDIR /go/src/github.com/brancz/kube-rbac-proxy
COPY . .
ENV GO111MODULE=on
# GOFLAGS is needed to build image without accessing external sources, mostly to comply with ART policies
ENV GOFLAGS="-mod=vendor"
RUN make build && \
    cp _output/kube-rbac-proxy-$(go env GOOS)-$(go env GOARCH) _output/kube-rbac-proxy

FROM openshift/ose-base:v4.6.0.20210123.015536
ENV __doozer=update BUILD_RELEASE=202101230113.p0 BUILD_VERSION=v4.6.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=6 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.6.0-202101230113.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=0163f7c OS_GIT_VERSION=4.6.0-202101230113.p0-0163f7c SOURCE_DATE_EPOCH=1608245684 SOURCE_GIT_COMMIT=0163f7c1cb7061a2f2de4c38c5e3c7f7921cb368 SOURCE_GIT_TAG=v0.3.1-140-g0163f7c1 SOURCE_GIT_URL=https://github.com/openshift/kube-rbac-proxy 

ARG FROM_DIRECTORY=/go/src/github.com/brancz/kube-rbac-proxy
COPY --from=builder ${FROM_DIRECTORY}/_output/kube-rbac-proxy  /usr/bin/kube-rbac-proxy

USER 65534
EXPOSE 8080
ENTRYPOINT ["/usr/bin/kube-rbac-proxy"]

LABEL \
        io.k8s.display-name="kube-rbac-proxy" \
        io.k8s.description="This is a proxy, that can perform Kubernetes RBAC authorization." \
        io.openshift.tags="kubernetes" \
        summary="" \
        maintainer="OpenShift Monitoring Team <team-monitoring@redhat.com>" \
        License="ASL 2.0" \
        vendor="Red Hat" \
        name="openshift/ose-kube-rbac-proxy" \
        com.redhat.component="kube-rbac-proxy-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Monitoring" \
        release="202101230113.p0" \
        io.openshift.build.commit.id="0163f7c1cb7061a2f2de4c38c5e3c7f7921cb368" \
        io.openshift.build.source-location="https://github.com/openshift/kube-rbac-proxy" \
        io.openshift.build.commit.url="https://github.com/openshift/kube-rbac-proxy/commit/0163f7c1cb7061a2f2de4c38c5e3c7f7921cb368" \
        version="v4.6.0"

