# 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=202111301700.p0.g30668ec.assembly.stream 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-202111301700.p0.g30668ec.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=30668ec OS_GIT_VERSION=4.6.0-202111301700.p0.g30668ec.assembly.stream-30668ec SOURCE_DATE_EPOCH=1610668297 SOURCE_GIT_COMMIT=30668ec22bd3e92ae2bb258aeff8aca744377574 SOURCE_GIT_TAG=30668ec2 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=202111301700.p0.g30668ec.assembly.stream 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-202111301700.p0.g30668ec.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=30668ec OS_GIT_VERSION=4.6.0-202111301700.p0.g30668ec.assembly.stream-30668ec SOURCE_DATE_EPOCH=1610668297 SOURCE_GIT_COMMIT=30668ec22bd3e92ae2bb258aeff8aca744377574 SOURCE_GIT_TAG=30668ec2 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.20211130.171945
ENV __doozer=update BUILD_RELEASE=202111301700.p0.g30668ec.assembly.stream 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-202111301700.p0.g30668ec.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=30668ec OS_GIT_VERSION=4.6.0-202111301700.p0.g30668ec.assembly.stream-30668ec SOURCE_DATE_EPOCH=1610668297 SOURCE_GIT_COMMIT=30668ec22bd3e92ae2bb258aeff8aca744377574 SOURCE_GIT_TAG=30668ec2 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="202111301700.p0.g30668ec.assembly.stream" \
        io.openshift.build.commit.id="30668ec22bd3e92ae2bb258aeff8aca744377574" \
        io.openshift.build.source-location="https://github.com/openshift/multus-cni" \
        io.openshift.build.commit.url="https://github.com/openshift/multus-cni/commit/30668ec22bd3e92ae2bb258aeff8aca744377574" \
        version="v4.6.0"

