# This dockerfile is specific to building the network metrics daemon for OpenShift
FROM openshift/golang-builder:1.13 AS builder
ENV __doozer=update BUILD_RELEASE=202102200202.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202102200202.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=8e3bbcc OS_GIT_VERSION=4.5.0-202102200202.p0-8e3bbcc SOURCE_DATE_EPOCH=1587373608 SOURCE_GIT_COMMIT=8e3bbcc67b83b6db17819f870c0db1e085d7e133 SOURCE_GIT_TAG=8e3bbcc SOURCE_GIT_URL=https://github.com/openshift/network-metrics-daemon 

# Add everything
ENV PKG_NAME=github.com/openshift/network-metrics-daemon
ENV PKG_PATH=/go/src/$PKG_NAME
RUN mkdir -p $PKG_PATH

COPY . $PKG_PATH/
WORKDIR $PKG_PATH

RUN make build-bin

WORKDIR /

FROM openshift/ose-base:v4.5.0.20210220.024259
ENV __doozer=update BUILD_RELEASE=202102200202.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202102200202.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=8e3bbcc OS_GIT_VERSION=4.5.0-202102200202.p0-8e3bbcc SOURCE_DATE_EPOCH=1587373608 SOURCE_GIT_COMMIT=8e3bbcc67b83b6db17819f870c0db1e085d7e133 SOURCE_GIT_TAG=8e3bbcc SOURCE_GIT_URL=https://github.com/openshift/network-metrics-daemon 
COPY --from=builder /go/src/github.com/openshift/network-metrics-daemon/bin/network-metrics-daemon /usr/bin/network-metrics


CMD ["/usr/bin/network-metrics"]

LABEL \
        io.k8s.display-name="Network Metrics Daemon" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides a daemon that exposes admission controller for Multus CNI custom resources." \
        io.openshift.tags="openshift" \
        maintainer="Federico Paolinelli <fpaoline@redhat.com>" \
        name="openshift/ose-network-metrics-daemon" \
        com.redhat.component="ose-network-metrics-daemon-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        io.openshift.maintainer.subcomponent="multus" \
        release="202102200202.p0" \
        io.openshift.build.commit.id="8e3bbcc67b83b6db17819f870c0db1e085d7e133" \
        io.openshift.build.source-location="https://github.com/openshift/network-metrics-daemon" \
        io.openshift.build.commit.url="https://github.com/openshift/network-metrics-daemon/commit/8e3bbcc67b83b6db17819f870c0db1e085d7e133" \
        version="v4.5.0"

