# This dockerfile is specific to building Multus admission controller for OpenShift
FROM openshift/golang-builder:1.12 AS builder
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=10 OS_GIT_VERSION=4.3.10-202003311428-ead10a3 OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=ead10a3cf30c5b4a2fbd7c987d83c07a46c5d5da SOURCE_GIT_TAG=ead10a3 SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller SOURCE_DATE_EPOCH=1575640859 OS_GIT_COMMIT=ead10a3 BUILD_VERSION=v4.3.10 BUILD_RELEASE=202003311428

# 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.3.10.20200331.142813
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=3 OS_GIT_PATCH=10 OS_GIT_VERSION=4.3.10-202003311428-ead10a3 OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=ead10a3cf30c5b4a2fbd7c987d83c07a46c5d5da SOURCE_GIT_TAG=ead10a3 SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller SOURCE_DATE_EPOCH=1575640859 OS_GIT_COMMIT=ead10a3 BUILD_VERSION=v4.3.10 BUILD_RELEASE=202003311428
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.3.10" \
        release="202003311428" \
        io.openshift.build.commit.id="ead10a3cf30c5b4a2fbd7c987d83c07a46c5d5da" \
        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/ead10a3cf30c5b4a2fbd7c987d83c07a46c5d5da"

