FROM openshift/golang-builder:rhel_8_golang_1.16 AS rhel8
ENV __doozer=update BUILD_RELEASE=202108130208.p0.git.016bea1.assembly.stream BUILD_VERSION=v4.8.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=8 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.8.0-202108130208.p0.git.016bea1.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=016bea1 OS_GIT_VERSION=4.8.0-202108130208.p0.git.016bea1.assembly.stream-016bea1 SOURCE_DATE_EPOCH=1622734702 SOURCE_GIT_COMMIT=016bea1a6f5ec53aab8e936f4120c32a05322027 SOURCE_GIT_TAG=016bea1 SOURCE_GIT_URL=https://github.com/openshift/egress-router-cni 
ADD . /go/src/github.com/openshift/egress-router-cni
WORKDIR /go/src/github.com/openshift/egress-router-cni
ENV GO111MODULE=on
ENV VERSION=rhel8 COMMIT=unset
RUN go build -mod vendor -o bin/egress-router cmd/egress-router/egress-router.go

FROM openshift/golang-builder:1.16 AS rhel7
ENV __doozer=update BUILD_RELEASE=202108130208.p0.git.016bea1.assembly.stream BUILD_VERSION=v4.8.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=8 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.8.0-202108130208.p0.git.016bea1.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=016bea1 OS_GIT_VERSION=4.8.0-202108130208.p0.git.016bea1.assembly.stream-016bea1 SOURCE_DATE_EPOCH=1622734702 SOURCE_GIT_COMMIT=016bea1a6f5ec53aab8e936f4120c32a05322027 SOURCE_GIT_TAG=016bea1 SOURCE_GIT_URL=https://github.com/openshift/egress-router-cni 
ADD . /go/src/github.com/openshift/egress-router-cni
WORKDIR /go/src/github.com/openshift/egress-router-cni
ENV GO111MODULE=on
RUN go build -mod vendor -o bin/egress-router cmd/egress-router/egress-router.go

FROM openshift/ose-base:v4.8.0.20210813.021751
ENV __doozer=update BUILD_RELEASE=202108130208.p0.git.016bea1.assembly.stream BUILD_VERSION=v4.8.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=8 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.8.0-202108130208.p0.git.016bea1.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=016bea1 OS_GIT_VERSION=4.8.0-202108130208.p0.git.016bea1.assembly.stream-016bea1 SOURCE_DATE_EPOCH=1622734702 SOURCE_GIT_COMMIT=016bea1a6f5ec53aab8e936f4120c32a05322027 SOURCE_GIT_TAG=016bea1 SOURCE_GIT_URL=https://github.com/openshift/egress-router-cni 
RUN mkdir -p /usr/src/egress-router-cni/bin/ && \
    mkdir -p /usr/src/egress-router-cni/rhel7/bin && \
    mkdir -p /usr/src/egress-router-cni/rhel8/bin
COPY --from=rhel7 /go/src/github.com/openshift/egress-router-cni/bin/egress-router /usr/src/egress-router-cni/rhel7/bin/egress-router
COPY --from=rhel8 /go/src/github.com/openshift/egress-router-cni/bin/egress-router /usr/src/egress-router-cni/bin/egress-router
COPY --from=rhel8 /go/src/github.com/openshift/egress-router-cni/bin/egress-router /usr/src/egress-router-cni/rhel8/bin/egress-router

LABEL \
        io.k8s.display-name="Egress Router CNI" \
        io.k8s.description="CNI Plugin for Egress Router" \
        io.openshift.tags="openshift" \
        maintainer="Daniel Mellado <dmellado@redhat.com>" \
        name="openshift/ose-egress-router-cni" \
        com.redhat.component="ose-egress-router-cni-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        release="202108130208.p0.git.016bea1.assembly.stream" \
        io.openshift.build.commit.id="016bea1a6f5ec53aab8e936f4120c32a05322027" \
        io.openshift.build.source-location="https://github.com/openshift/egress-router-cni" \
        io.openshift.build.commit.url="https://github.com/openshift/egress-router-cni/commit/016bea1a6f5ec53aab8e936f4120c32a05322027" \
        version="v4.8.0"

