# This dockerfile is used for building for OpenShift
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.15-openshift-4.7 AS rhel8
ADD . /usr/src/route-override
WORKDIR /usr/src/route-override
ENV CGO_ENABLED=0
ENV GO111MODULE=off
ENV VERSION=rhel8 COMMIT=unset
RUN ./build_linux.sh
WORKDIR /

FROM registry.ci.openshift.org/ocp/builder:rhel-7-golang-1.15-openshift-4.7 AS rhel7
ADD . /usr/src/route-override
WORKDIR /usr/src/route-override
ENV CGO_ENABLED=0
ENV GO111MODULE=off
RUN ./build_linux.sh
WORKDIR /

FROM registry.ci.openshift.org/ocp/builder:rhel-8-base-openshift-4.7
COPY --from=rhel7 /usr/src/route-override/bin/route-override /usr/src/route-override/rhel7/bin/route-override
COPY --from=rhel8 /usr/src/route-override/bin/route-override /usr/src/route-override/bin/route-override
COPY --from=rhel8 /usr/src/route-override/bin/route-override /usr/src/route-override/rhel8/bin/route-override

LABEL io.k8s.display-name="route override CNI" \
      io.k8s.description="This is a component of OpenShift Container Platform and provides a CNI plugin to override routes" \
      io.openshift.tags="openshift" \
      maintainer="CTO Networking <nfvpe-container@redhat.com>"
