# This dockerfile is specific to building the network metrics daemon for OpenShift
FROM openshift/golang-builder:rhel_8_golang_1.15 AS builder
ENV __doozer=update BUILD_RELEASE=202107070256.p0.git.c5b56ed BUILD_VERSION=v4.6.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=6 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.6.0-202107070256.p0.git.c5b56ed SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=c5b56ed OS_GIT_VERSION=4.6.0-202107070256.p0.git.c5b56ed-c5b56ed SOURCE_DATE_EPOCH=1601494235 SOURCE_GIT_COMMIT=c5b56ed97be71c04fe1e56dbee3bbbb1dc28f4ad SOURCE_GIT_TAG=c5b56ed 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.6.0.20210707.033320
ENV __doozer=update BUILD_RELEASE=202107070256.p0.git.c5b56ed BUILD_VERSION=v4.6.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=6 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.6.0-202107070256.p0.git.c5b56ed SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=c5b56ed OS_GIT_VERSION=4.6.0-202107070256.p0.git.c5b56ed-c5b56ed SOURCE_DATE_EPOCH=1601494235 SOURCE_GIT_COMMIT=c5b56ed97be71c04fe1e56dbee3bbbb1dc28f4ad SOURCE_GIT_TAG=c5b56ed 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="202107070256.p0.git.c5b56ed" \
        io.openshift.build.commit.id="c5b56ed97be71c04fe1e56dbee3bbbb1dc28f4ad" \
        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/c5b56ed97be71c04fe1e56dbee3bbbb1dc28f4ad" \
        version="v4.6.0"

