FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.15-openshift-4.7 AS builder
WORKDIR /go/src/github.com/openshift/kubernetes-nmstate
COPY . .
RUN GO111MODULE=on go build --mod=vendor -o build/_output/bin/manager main.go

FROM registry.ci.openshift.org/ocp/4.7:base

RUN \
    microdnf -y update && \
    microdnf -y install \
        nmstate \
        iputils \
        iproute && \
    microdnf clean all


COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/build/_output/bin/manager  /usr/bin/
COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/build/bin   /usr/bin/

ENTRYPOINT ["/usr/bin/manager"]

LABEL io.k8s.display-name="kubernetes-nmstate-handler" \
      io.k8s.description="Configure node networking through Kubernetes API" \
      maintainer="Yossi Boaron <yboaron@redhat.com>"
