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

COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/build/_output/bin/manager /usr/bin/
COPY deploy/crds/nmstate.io_nodenetwork*.yaml /bindata/kubernetes-nmstate/crds/
COPY deploy/handler/namespace.yaml /bindata/kubernetes-nmstate/namespace/
COPY deploy/handler/operator.yaml /bindata/kubernetes-nmstate/handler/handler.yaml
COPY deploy/handler/service_account.yaml /bindata/kubernetes-nmstate/rbac/
COPY deploy/handler/role.yaml /bindata/kubernetes-nmstate/rbac/
COPY deploy/handler/role_binding.yaml /bindata/kubernetes-nmstate/rbac/
COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/manifests /manifests
COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/metadata /metadata

ENTRYPOINT ["manager"]

LABEL io.k8s.display-name="kubernetes-nmstate-operator" \
      io.k8s.description="Operator for Node network configuration through Kubernetes API" \
      io.openshift.tags="openshift,kubernetes-nmstate-operator" \
      com.redhat.delivery.appregistry=true \
      maintainer="Yossi Boaron <yboaron@redhat.com>"
