# This dockerfile is specific to building Multus for OpenShift
FROM openshift/golang-builder:rhel_8_golang_1.12 AS rhel8
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=9 OS_GIT_VERSION=4.3.9-202003230345-386465f OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=386465fe170c0e7299b357efbace235a3e5ce7ee SOURCE_GIT_TAG=386465f SOURCE_GIT_URL=https://github.com/openshift/containernetworking-plugins SOURCE_DATE_EPOCH=1572976867 OS_GIT_COMMIT=386465f BUILD_VERSION=v4.3.9 BUILD_RELEASE=202003230345
ADD . /usr/src/plugins
WORKDIR /usr/src/plugins
ENV CGO_ENABLED=0
RUN ./build_linux.sh && \
    cd /usr/src/plugins/bin
WORKDIR /

FROM openshift/golang-builder:1.12 AS rhel7
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=9 OS_GIT_VERSION=4.3.9-202003230345-386465f OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=386465fe170c0e7299b357efbace235a3e5ce7ee SOURCE_GIT_TAG=386465f SOURCE_GIT_URL=https://github.com/openshift/containernetworking-plugins SOURCE_DATE_EPOCH=1572976867 OS_GIT_COMMIT=386465f BUILD_VERSION=v4.3.9 BUILD_RELEASE=202003230345
ADD . /usr/src/plugins
WORKDIR /usr/src/plugins
ENV CGO_ENABLED=0
RUN ./build_linux.sh && \
    cd /usr/src/plugins/bin
WORKDIR /

FROM openshift/ose-base:v4.3.9.20200323.034557
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=9 OS_GIT_VERSION=4.3.9-202003230345-386465f OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=386465fe170c0e7299b357efbace235a3e5ce7ee SOURCE_GIT_TAG=386465f SOURCE_GIT_URL=https://github.com/openshift/containernetworking-plugins SOURCE_DATE_EPOCH=1572976867 OS_GIT_COMMIT=386465f BUILD_VERSION=v4.3.9 BUILD_RELEASE=202003230345
RUN mkdir -p /usr/src/plugins/bin && \
    mkdir -p /usr/src/plugins/rhel7/bin && \
    mkdir -p /usr/src/plugins/rhel8/bin
COPY --from=rhel7 /usr/src/plugins/bin/* /usr/src/plugins/rhel7/bin/
COPY --from=rhel7 /usr/src/plugins/bin/* /usr/src/plugins/bin/
COPY --from=rhel8 /usr/src/plugins/bin/* /usr/src/plugins/rhel8/bin/

LABEL \
        io.k8s.display-name="Container Networking Plugins" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides the reference CNI plugins." \
        io.openshift.tags="openshift" \
        maintainer="Doug Smith <dosmith@redhat.com>" \
        name="openshift/ose-container-networking-plugins" \
        com.redhat.component="ose-containernetworking-plugins-container" \
        version="v4.3.9" \
        release="202003230345" \
        io.openshift.build.commit.id="386465fe170c0e7299b357efbace235a3e5ce7ee" \
        io.openshift.build.source-location="https://github.com/openshift/containernetworking-plugins" \
        io.openshift.build.commit.url="https://github.com/openshift/containernetworking-plugins/commit/386465fe170c0e7299b357efbace235a3e5ce7ee"

