FROM openshift/golang-builder:rhel_8_golang_1.15 AS rhel8
ENV __doozer=update BUILD_RELEASE=202106011423.p0.git.96ebd37 BUILD_VERSION=v4.7.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=7 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.7.0-202106011423.p0.git.96ebd37 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=96ebd37 OS_GIT_VERSION=4.7.0-202106011423.p0.git.96ebd37-96ebd37 SOURCE_DATE_EPOCH=1612432401 SOURCE_GIT_COMMIT=96ebd3782cbb63de098e75ebcedeac60546cfee3 SOURCE_GIT_TAG=96ebd37 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.15 AS rhel7
ENV __doozer=update BUILD_RELEASE=202106011423.p0.git.96ebd37 BUILD_VERSION=v4.7.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=7 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.7.0-202106011423.p0.git.96ebd37 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=96ebd37 OS_GIT_VERSION=4.7.0-202106011423.p0.git.96ebd37-96ebd37 SOURCE_DATE_EPOCH=1612432401 SOURCE_GIT_COMMIT=96ebd3782cbb63de098e75ebcedeac60546cfee3 SOURCE_GIT_TAG=96ebd37 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.7.0.20210601.144050
ENV __doozer=update BUILD_RELEASE=202106011423.p0.git.96ebd37 BUILD_VERSION=v4.7.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=7 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.7.0-202106011423.p0.git.96ebd37 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=96ebd37 OS_GIT_VERSION=4.7.0-202106011423.p0.git.96ebd37-96ebd37 SOURCE_DATE_EPOCH=1612432401 SOURCE_GIT_COMMIT=96ebd3782cbb63de098e75ebcedeac60546cfee3 SOURCE_GIT_TAG=96ebd37 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="202106011423.p0.git.96ebd37" \
        io.openshift.build.commit.id="96ebd3782cbb63de098e75ebcedeac60546cfee3" \
        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/96ebd3782cbb63de098e75ebcedeac60546cfee3" \
        version="v4.7.0"

