# 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.12 AS builder
ENV SOURCE_GIT_COMMIT=1d7211968ceb449852d10d12eae92ed5c33d8b48 SOURCE_GIT_TAG=openshift-clients-4.3-16-g1d721196 SOURCE_GIT_URL=https://github.com/openshift/oc SOURCE_DATE_EPOCH=1581524534 BUILD_VERSION=v4.3.3 BUILD_RELEASE=202002171705
WORKDIR /go/src/github.com/openshift/oc
COPY . .
RUN yum install -y --setopt=skip_missing_names_on_install=False gpgme-devel libassuan-devel
RUN make cross-build --warn-undefined-variables

FROM openshift/ose-cli:v4.3.3.20200217.170535
ENV SOURCE_GIT_COMMIT=1d7211968ceb449852d10d12eae92ed5c33d8b48 SOURCE_GIT_TAG=openshift-clients-4.3-16-g1d721196 SOURCE_GIT_URL=https://github.com/openshift/oc SOURCE_DATE_EPOCH=1581524534 BUILD_VERSION=v4.3.3 BUILD_RELEASE=202002171705
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

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" \
        version="v4.3.3" \
        release="202002171705" \
        io.openshift.build.commit.id="1d7211968ceb449852d10d12eae92ed5c33d8b48" \
        io.openshift.build.source-location="https://github.com/openshift/oc" \
        io.openshift.build.commit.url="https://github.com/openshift/oc/commit/1d7211968ceb449852d10d12eae92ed5c33d8b48"

