FROM openshift/golang-builder:rhel_8_golang_1.15 AS builder
ENV __doozer=update BUILD_RELEASE=202107230321.p0.git.e3f009d 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-202107230321.p0.git.e3f009d SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=e3f009d OS_GIT_VERSION=4.6.0-202107230321.p0.git.e3f009d-e3f009d SOURCE_DATE_EPOCH=1622167302 SOURCE_GIT_COMMIT=e3f009da89c0357fed1a176af618061dcb184793 SOURCE_GIT_TAG=e3f009da 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.20210723.033016
ENV __doozer=update BUILD_RELEASE=202107230321.p0.git.e3f009d 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-202107230321.p0.git.e3f009d SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=e3f009d OS_GIT_VERSION=4.6.0-202107230321.p0.git.e3f009d-e3f009d SOURCE_DATE_EPOCH=1622167302 SOURCE_GIT_COMMIT=e3f009da89c0357fed1a176af618061dcb184793 SOURCE_GIT_TAG=e3f009da 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="202107230321.p0.git.e3f009d" \
        io.openshift.build.commit.id="e3f009da89c0357fed1a176af618061dcb184793" \
        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/e3f009da89c0357fed1a176af618061dcb184793" \
        version="v4.6.0"

