# This Dockerfile builds an image containing the Mac and Windows version of oc
# layered on top of the Linux cli image.
FROM openshift/golang-builder:1.15 AS builder
ENV __doozer=update BUILD_RELEASE=202107082022.p0.git.2b525e8 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-202107082022.p0.git.2b525e8 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=2b525e8 OS_GIT_VERSION=4.6.0-202107082022.p0.git.2b525e8-2b525e8 SOURCE_DATE_EPOCH=1625773030 SOURCE_GIT_COMMIT=2b525e8d2647a41e686bc7da5b7430667a13953e SOURCE_GIT_TAG=openshift-clients-4.6.0-202006250705.p0-230-g2b525e8d2 SOURCE_GIT_URL=https://github.com/openshift/oc 
WORKDIR /go/src/github.com/openshift/oc
COPY . .
RUN make cross-build --warn-undefined-variables

FROM openshift/ose-cli:v4.6.0.20210708.205954
ENV __doozer=update BUILD_RELEASE=202107082022.p0.git.2b525e8 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-202107082022.p0.git.2b525e8 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=2b525e8 OS_GIT_VERSION=4.6.0-202107082022.p0.git.2b525e8-2b525e8 SOURCE_DATE_EPOCH=1625773030 SOURCE_GIT_COMMIT=2b525e8d2647a41e686bc7da5b7430667a13953e SOURCE_GIT_TAG=openshift-clients-4.6.0-202006250705.p0-230-g2b525e8d2 SOURCE_GIT_URL=https://github.com/openshift/oc 
COPY --from=builder /go/src/github.com/openshift/oc/_output/bin/darwin_amd64/oc /usr/share/openshift/mac/oc
COPY --from=builder /go/src/github.com/openshift/oc/_output/bin/windows_amd64/oc.exe /usr/share/openshift/windows/oc.exe
COPY --from=builder /go/src/github.com/openshift/oc/_output/bin/linux_amd64/oc /usr/share/openshift/linux_amd64/oc
COPY --from=builder /go/src/github.com/openshift/oc/_output/bin/linux_arm64/oc /usr/share/openshift/linux_arm64/oc
COPY --from=builder /go/src/github.com/openshift/oc/_output/bin/linux_ppc64le/oc /usr/share/openshift/linux_ppc64le/oc
COPY --from=builder /go/src/github.com/openshift/oc/_output/bin/linux_s390x/oc /usr/share/openshift/linux_s390x/oc
COPY --from=builder /go/src/github.com/openshift/oc/LICENSE /usr/share/openshift/LICENSE

LABEL \
        io.k8s.display-name="OpenShift Clients" \
        io.k8s.description="OpenShift is a platform for developing, building, and deploying containerized applications." \
        io.openshift.tags="openshift,cli" \
        name="openshift/ose-cli-artifacts" \
        com.redhat.component="ose-cli-artifacts-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="oc" \
        release="202107082022.p0.git.2b525e8" \
        io.openshift.build.commit.id="2b525e8d2647a41e686bc7da5b7430667a13953e" \
        io.openshift.build.source-location="https://github.com/openshift/oc" \
        io.openshift.build.commit.url="https://github.com/openshift/oc/commit/2b525e8d2647a41e686bc7da5b7430667a13953e" \
        version="v4.6.0"

