# This dockerfile is specific to building Multus for OpenShift
FROM openshift/golang-builder:rhel_8_golang_1.13 AS rhel8
ENV __doozer=update BUILD_RELEASE=202007012112.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202007012112.p0 
ENV __doozer=merge OS_GIT_COMMIT=69a2963 OS_GIT_VERSION=4.5.0-202007012112.p0-69a2963 SOURCE_DATE_EPOCH=1589330534 SOURCE_GIT_COMMIT=69a29635255631b2f991d49d7a12b5c68f68e7ce SOURCE_GIT_TAG=69a29635 SOURCE_GIT_URL=https://github.com/openshift/multus-cni 
ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni
ENV CGO_ENABLED=1
ENV GO111MODULE=off
ENV VERSION=rhel8 COMMIT=unset
RUN ./build && \
       cd /usr/src/multus-cni/bin
WORKDIR /

FROM openshift/golang-builder:1.13 AS rhel7
ENV __doozer=update BUILD_RELEASE=202007012112.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202007012112.p0 
ENV __doozer=merge OS_GIT_COMMIT=69a2963 OS_GIT_VERSION=4.5.0-202007012112.p0-69a2963 SOURCE_DATE_EPOCH=1589330534 SOURCE_GIT_COMMIT=69a29635255631b2f991d49d7a12b5c68f68e7ce SOURCE_GIT_TAG=69a29635 SOURCE_GIT_URL=https://github.com/openshift/multus-cni 
ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni
ENV CGO_ENABLED=1
ENV GO111MODULE=off
RUN ./build && \
       cd /usr/src/multus-cni/bin

WORKDIR /usr/src/multus-cni
ENV GO111MODULE=off
RUN ./build && \
       cd /usr/src/multus-cni/bin
WORKDIR /

FROM openshift/ose-base:v4.5.0.20200701.222638
ENV __doozer=update BUILD_RELEASE=202007012112.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202007012112.p0 
ENV __doozer=merge OS_GIT_COMMIT=69a2963 OS_GIT_VERSION=4.5.0-202007012112.p0-69a2963 SOURCE_DATE_EPOCH=1589330534 SOURCE_GIT_COMMIT=69a29635255631b2f991d49d7a12b5c68f68e7ce SOURCE_GIT_TAG=69a29635 SOURCE_GIT_URL=https://github.com/openshift/multus-cni 
RUN mkdir -p /usr/src/multus-cni/images && \
       mkdir -p /usr/src/multus-cni/bin && \
       mkdir -p /usr/src/multus-cni/rhel7/bin && \
       mkdir -p /usr/src/multus-cni/rhel8/bin
COPY --from=rhel7 /usr/src/multus-cni/bin/multus /usr/src/multus-cni/rhel7/bin
COPY --from=rhel7 /usr/src/multus-cni/bin/multus /usr/src/multus-cni/bin
COPY --from=rhel8 /usr/src/multus-cni/bin/multus /usr/src/multus-cni/rhel8/bin
ADD ./images/entrypoint.sh /


ENTRYPOINT ["/entrypoint.sh"]

LABEL \
        io.k8s.display-name="Multus CNI" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides a meta CNI plugin." \
        io.openshift.tags="openshift" \
        maintainer="Doug Smith <dosmith@redhat.com>" \
        vendor="Red Hat" \
        name="openshift/ose-multus-cni" \
        com.redhat.component="multus-cni-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        io.openshift.maintainer.subcomponent="multus" \
        release="202007012112.p0" \
        io.openshift.build.commit.id="69a29635255631b2f991d49d7a12b5c68f68e7ce" \
        io.openshift.build.source-location="https://github.com/openshift/multus-cni" \
        io.openshift.build.commit.url="https://github.com/openshift/multus-cni/commit/69a29635255631b2f991d49d7a12b5c68f68e7ce" \
        version="v4.5.0"

