FROM openshift/golang-builder@sha256:2c34135dc4d4a35fa19775e4e559e2e6f2e476a0ccdc993360e3663729904035 AS builder
ENV __doozer=update BUILD_RELEASE=202201261125.p0.gd642d11.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202201261125.p0.gd642d11.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=d642d11 OS_GIT_VERSION=4.9.0-202201261125.p0.gd642d11.assembly.stream-d642d11 SOURCE_DATE_EPOCH=1638333583 SOURCE_GIT_COMMIT=d642d1125fa4f68415ad7562aab2efa8015cc251 SOURCE_GIT_TAG=d642d112 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
RUN go build -ldflags "-X $GO_PACKAGE/pkg/version.versionFromGit=$(git describe --long --tags --abbrev=7 --match 'v[0-9]*')" ./cmd/ccoctl

FROM openshift/ose-base:v4.9.0.20220126.115034
ENV __doozer=update BUILD_RELEASE=202201261125.p0.gd642d11.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202201261125.p0.gd642d11.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=d642d11 OS_GIT_VERSION=4.9.0-202201261125.p0.gd642d11.assembly.stream-d642d11 SOURCE_DATE_EPOCH=1638333583 SOURCE_GIT_COMMIT=d642d1125fa4f68415ad7562aab2efa8015cc251 SOURCE_GIT_TAG=d642d112 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 --from=builder /go/src/github.com/openshift/cloud-credential-operator/ccoctl /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="202201261125.p0.gd642d11.assembly.stream" \
        io.openshift.build.commit.id="d642d1125fa4f68415ad7562aab2efa8015cc251" \
        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/d642d1125fa4f68415ad7562aab2efa8015cc251" \
        version="v4.9.0"

