# 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=d5465d715197862b15c8cf05e864d7c3cfea6917 SOURCE_DATE_EPOCH=1570221652 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/oc SOURCE_GIT_TAG=openshift-clients-4.2.0-201910041700 BUILD_RELEASE=201910101614
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-darwin-amd64 cross-build-windows-amd64 --warn-undefined-variables

FROM openshift/ose-cli:v4.2.0.20191010.161456
ENV SOURCE_GIT_COMMIT=d5465d715197862b15c8cf05e864d7c3cfea6917 SOURCE_DATE_EPOCH=1570221652 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/oc SOURCE_GIT_TAG=openshift-clients-4.2.0-201910041700 BUILD_RELEASE=201910101614
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

LABEL \
        io.k8s.description="OpenShift is a platform for developing, building, and deploying containerized applications." \
        com.redhat.component="ose-cli-artifacts-container" \
        name="openshift/ose-cli-artifacts" \
        io.k8s.display-name="OpenShift Clients" \
        io.openshift.build.source-location="https://github.com/openshift/oc" \
        io.openshift.build.commit.url="https://github.com/openshift/oc/commit/d5465d715197862b15c8cf05e864d7c3cfea6917" \
        version="v4.2.0" \
        io.openshift.build.commit.id="d5465d715197862b15c8cf05e864d7c3cfea6917" \
        release="201910101614" \
        io.openshift.tags="openshift,cli"

