#@follow_tag(ubi8-minimal:8-released)
FROM ubi8-minimal:8.1-279 AS builder

ENV GOPATH=/go

RUN microdnf install -y go-compilers-golang-compiler tar gzip

COPY ${CI_ARCHIVE_KUBEVIRT_CPU_NODE_LABELLER} /
RUN mkdir -p /go/src/kubevirt.io/node-labeller && \
    tar -xzf /${CI_ARCHIVE_KUBEVIRT_CPU_NODE_LABELLER} \
    --strip-components 1 -C /go/src/kubevirt.io/node-labeller && \
    cd /go/src/kubevirt.io/node-labeller/cmd/node-labeller && GOPROXY=off GOFLAGS=-mod=vendor go build -v

#@follow_tag(ubi8-minimal:8-released)
FROM ubi8-minimal:8.1-279
COPY --from=builder \
     /go/src/kubevirt.io/node-labeller/cmd/node-labeller/node-labeller && \
     /usr/sbin/
ENTRYPOINT [ "/usr/sbin/node-labeller"]

LABEL com.redhat.component="kubevirt-cpu-node-labeller-container" \
      name="container-native-virtualization/kubevirt-cpu-node-labeller" \
      version="${CI_CONTAINER_VERSION}" \
      upstream-version="v${CI_UPSTREAM_VERSION}" \
      summary="Kubernetes node labeller" \
      io.openshift.expose-services="" \
      io.openshift.tags="cnv,kubevirt,node" \
      io.k8s.display-name="kubevirt-cpu-node-labeller" \
      maintainer="The KubeVirt Project <kubevirt-dev@googlegroups.com>" \
      description="Provide functionality for labelling nodes with cpu models, features, kvm features."


