# This dockerfile is specific to building Multus admission controller for OpenShift
FROM openshift/golang-builder:1.10 AS builder
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=1 OS_GIT_PATCH=41 OS_GIT_VERSION=4.1.41-202004130646-5e1179e OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=5e1179efcc91d54f6874d51b08d325f3a22d6df1 SOURCE_GIT_TAG=5e1179e SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller SOURCE_DATE_EPOCH=1551835113 OS_GIT_COMMIT=5e1179e BUILD_VERSION=v4.1.41 BUILD_RELEASE=202004130646

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

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

WORKDIR /

FROM openshift/ose-base:v4.1.41.20200413.064634
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=1 OS_GIT_PATCH=41 OS_GIT_VERSION=4.1.41-202004130646-5e1179e OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=5e1179efcc91d54f6874d51b08d325f3a22d6df1 SOURCE_GIT_TAG=5e1179e SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller SOURCE_DATE_EPOCH=1551835113 OS_GIT_COMMIT=5e1179e BUILD_VERSION=v4.1.41 BUILD_RELEASE=202004130646
COPY --from=builder /go/src/github.com/K8sNetworkPlumbingWG/net-attach-def-admission-controller/bin/webhook /usr/bin/
COPY --from=builder /go/src/github.com/K8sNetworkPlumbingWG/net-attach-def-admission-controller/bin/installer /usr/bin/


CMD ["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" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        version="v4.1.41" \
        release="202004130646" \
        io.openshift.build.commit.id="5e1179efcc91d54f6874d51b08d325f3a22d6df1" \
        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/5e1179efcc91d54f6874d51b08d325f3a22d6df1"

