# 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 OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=10 OS_GIT_VERSION=4.3.10-202003311428-081196c OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=081196cac40a01e541152175cc4da92d3a5ab07d SOURCE_GIT_TAG=openshift-clients-4.3.10-202003300415-2-g081196ca SOURCE_GIT_URL=https://github.com/openshift/oc SOURCE_DATE_EPOCH=1585646197 OS_GIT_COMMIT=081196c BUILD_VERSION=v4.3.10 BUILD_RELEASE=202003311428
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.10.20200331.142813
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=10 OS_GIT_VERSION=4.3.10-202003311428-081196c OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=081196cac40a01e541152175cc4da92d3a5ab07d SOURCE_GIT_TAG=openshift-clients-4.3.10-202003300415-2-g081196ca SOURCE_GIT_URL=https://github.com/openshift/oc SOURCE_DATE_EPOCH=1585646197 OS_GIT_COMMIT=081196c BUILD_VERSION=v4.3.10 BUILD_RELEASE=202003311428
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.10" \
        release="202003311428" \
        io.openshift.build.commit.id="081196cac40a01e541152175cc4da92d3a5ab07d" \
        io.openshift.build.source-location="https://github.com/openshift/oc" \
        io.openshift.build.commit.url="https://github.com/openshift/oc/commit/081196cac40a01e541152175cc4da92d3a5ab07d"

