# This dockerfile is specific to building Multus admission controller for OpenShift
FROM openshift/golang-builder:1.11 AS builder
ENV SOURCE_GIT_COMMIT=ccd6c61c10aaa02c31a2053a1a6ac587cee6abb6 SOURCE_GIT_TAG=ccd6c61 SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller SOURCE_DATE_EPOCH=1566439972 BUILD_VERSION=v4.2.18 BUILD_RELEASE=202002031246

# Add everything
ENV PKG_NAME=github.com/K8sNetworkPlumbingWG/net-attach-def-admission-controller
ENV PKG_PATH=/go/src/$PKG_NAME
ENV GO111MODULE=off
RUN mkdir -p $PKG_PATH

COPY . $PKG_PATH/
WORKDIR $PKG_PATH
# RUN go install ./...
RUN ./build.sh

WORKDIR /

FROM openshift/ose-base:v4.2.18.20200203.124646
ENV SOURCE_GIT_COMMIT=ccd6c61c10aaa02c31a2053a1a6ac587cee6abb6 SOURCE_GIT_TAG=ccd6c61 SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller SOURCE_DATE_EPOCH=1566439972 BUILD_VERSION=v4.2.18 BUILD_RELEASE=202002031246
COPY --from=builder /go/src/github.com/K8sNetworkPlumbingWG/net-attach-def-admission-controller/bin/webhook /usr/bin/


CMD ["/usr/bin/webhook"]

LABEL \
        io.k8s.display-name="Container Networking Plugins" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides an admission controller for Multus CNI custom resources." \
        io.openshift.tags="openshift" \
        maintainer="Doug Smith <dosmith@redhat.com>" \
        name="openshift/ose-multus-admission-controller" \
        com.redhat.component="ose-multus-admission-controller-container" \
        version="v4.2.18" \
        release="202002031246" \
        io.openshift.build.commit.id="ccd6c61c10aaa02c31a2053a1a6ac587cee6abb6" \
        io.openshift.build.source-location="https://github.com/openshift/multus-admission-controller" \
        io.openshift.build.commit.url="https://github.com/openshift/multus-admission-controller/commit/ccd6c61c10aaa02c31a2053a1a6ac587cee6abb6"

