# This dockerfile is specific to building Multus for OpenShift
FROM openshift/golang-builder:rhel_8_golang_1.15 AS rhel8
ENV __doozer=update BUILD_RELEASE=202011261617.p0 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-202011261617.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge KUBE_GIT_COMMIT=dffa09195bd2632179d0fa0ec43f289462ff514b KUBE_GIT_MAJOR=1 KUBE_GIT_MINOR=13+ KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.13.0+dffa091 OS_GIT_COMMIT=dffa091 OS_GIT_VERSION=4.6.0-202011261617.p0-dffa091 SOURCE_DATE_EPOCH=1601575369 SOURCE_GIT_COMMIT=dffa09195bd2632179d0fa0ec43f289462ff514b SOURCE_GIT_TAG=dffa0919 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.15 AS rhel7
ENV __doozer=update BUILD_RELEASE=202011261617.p0 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-202011261617.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge KUBE_GIT_COMMIT=dffa09195bd2632179d0fa0ec43f289462ff514b KUBE_GIT_MAJOR=1 KUBE_GIT_MINOR=13+ KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.13.0+dffa091 OS_GIT_COMMIT=dffa091 OS_GIT_VERSION=4.6.0-202011261617.p0-dffa091 SOURCE_DATE_EPOCH=1601575369 SOURCE_GIT_COMMIT=dffa09195bd2632179d0fa0ec43f289462ff514b SOURCE_GIT_TAG=dffa0919 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.6.0.20201126.164052
ENV __doozer=update BUILD_RELEASE=202011261617.p0 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-202011261617.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge KUBE_GIT_COMMIT=dffa09195bd2632179d0fa0ec43f289462ff514b KUBE_GIT_MAJOR=1 KUBE_GIT_MINOR=13+ KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.13.0+dffa091 OS_GIT_COMMIT=dffa091 OS_GIT_VERSION=4.6.0-202011261617.p0-dffa091 SOURCE_DATE_EPOCH=1601575369 SOURCE_GIT_COMMIT=dffa09195bd2632179d0fa0ec43f289462ff514b SOURCE_GIT_TAG=dffa0919 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=rhel8 /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="202011261617.p0" \
        io.openshift.build.commit.id="dffa09195bd2632179d0fa0ec43f289462ff514b" \
        io.openshift.build.source-location="https://github.com/openshift/multus-cni" \
        io.openshift.build.commit.url="https://github.com/openshift/multus-cni/commit/dffa09195bd2632179d0fa0ec43f289462ff514b" \
        version="v4.6.0"

