FROM openshift/golang-builder:rhel_8_golang_1.15 AS builder
ENV __doozer=update BUILD_RELEASE=202012160125.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-202012160125.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=f6027aa OS_GIT_VERSION=4.6.0-202012160125.p0-f6027aa SOURCE_DATE_EPOCH=1605501024 SOURCE_GIT_COMMIT=f6027aa8dce39f77d1a0018ae9376025df705af3 SOURCE_GIT_TAG=f6027aa8 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator 
WORKDIR /go/src/github.com/openshift/cloud-credential-operator
COPY . .
ENV GO_PACKAGE github.com/openshift/cloud-credential-operator
RUN go build -ldflags "-X $GO_PACKAGE/pkg/version.versionFromGit=$(git describe --long --tags --abbrev=7 --match 'v[0-9]*')" ./cmd/cloud-credential-operator

FROM openshift/ose-base:v4.6.0-202012152004.p0
ENV __doozer=update BUILD_RELEASE=202012160125.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-202012160125.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=f6027aa OS_GIT_VERSION=4.6.0-202012160125.p0-f6027aa SOURCE_DATE_EPOCH=1605501024 SOURCE_GIT_COMMIT=f6027aa8dce39f77d1a0018ae9376025df705af3 SOURCE_GIT_TAG=f6027aa8 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator 
COPY --from=builder /go/src/github.com/openshift/cloud-credential-operator/cloud-credential-operator /usr/bin/
COPY manifests /manifests
# Update perms so we can copy updated CA if needed
RUN chmod -R g+w /etc/pki/ca-trust/extracted/pem/
# TODO make path explicit here to remove need for ENTRYPOINT
# https://github.com/openshift/installer/blob/a8ddf6619794416c4600a827c2d9284724d382d8/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template#L347
ENTRYPOINT [ "/usr/bin/cloud-credential-operator" ]

LABEL \
        io.openshift.release.operator="true" \
        name="openshift/ose-cloud-credential-operator" \
        com.redhat.component="ose-cloud-credential-operator-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Cloud Credential Operator" \
        release="202012160125.p0" \
        io.openshift.build.commit.id="f6027aa8dce39f77d1a0018ae9376025df705af3" \
        io.openshift.build.source-location="https://github.com/openshift/cloud-credential-operator" \
        io.openshift.build.commit.url="https://github.com/openshift/cloud-credential-operator/commit/f6027aa8dce39f77d1a0018ae9376025df705af3" \
        version="v4.6.0"

