FROM openshift/golang-builder:1.13 AS build
ENV __doozer=update BUILD_RELEASE=202010301137.p0 BUILD_VERSION=v4.4.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=4 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.4.0-202010301137.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=b56aea2 OS_GIT_VERSION=4.4.0-202010301137.p0-b56aea2 SOURCE_DATE_EPOCH=1579122445 SOURCE_GIT_COMMIT=b56aea2c28d4d8f7a6337b508a29299e6738ba19 SOURCE_GIT_TAG=v2.8.2-22-gb56aea2c SOURCE_GIT_URL=https://github.com/kube-reporting/helm 

RUN yum install --setopt=skip_missing_names_on_install=False -y \
        hg git make \
    && yum clean all \
    && rm -rf /var/cache/yum

ENV GOPATH /go

RUN mkdir -p /go/src/k8s.io/helm
WORKDIR /go/src/k8s.io/helm
COPY . .

# unset VERSION inherited from base before building
ENV VERSION ""
RUN make build
RUN make docker-binary

FROM openshift/ose-base:ubi7
ENV __doozer=update BUILD_RELEASE=202010301137.p0 BUILD_VERSION=v4.4.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=4 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.4.0-202010301137.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=b56aea2 OS_GIT_VERSION=4.4.0-202010301137.p0-b56aea2 SOURCE_DATE_EPOCH=1579122445 SOURCE_GIT_COMMIT=b56aea2c28d4d8f7a6337b508a29299e6738ba19 SOURCE_GIT_TAG=v2.8.2-22-gb56aea2c SOURCE_GIT_URL=https://github.com/kube-reporting/helm 

COPY --from=build /go/src/k8s.io/helm/rootfs/tiller /usr/local/bin
COPY --from=build /go/src/k8s.io/helm/bin/helm /usr/local/bin
RUN ln -s /usr/local/bin/tiller /tiller

LABEL \
        io.k8s.display-name="OpenShift metering-helm" \
        io.k8s.description="This is a base image used by operator-metering to assist in managing the lifecycle of the Openshift Metering components." \
        io.openshift.tags="openshift" \
        maintainer="AOS Operator Metering <sd-operator-metering@redhat.com>" \
        name="openshift/ose-metering-helm" \
        com.redhat.component="ose-metering-helm-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Metering Operator" \
        release="202010301137.p0" \
        io.openshift.build.commit.id="b56aea2c28d4d8f7a6337b508a29299e6738ba19" \
        io.openshift.build.source-location="https://github.com/kube-reporting/helm" \
        io.openshift.build.commit.url="https://github.com/kube-reporting/helm/commit/b56aea2c28d4d8f7a6337b508a29299e6738ba19" \
        version="v4.4.0"

