FROM ubi8-minimal:8.2-339 AS builder

ENV GOPATH=/go

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

COPY kubevirt-cpu-model-nfd-plugin-a1a283eb43db58b3df901935101ce0faca2ed56a.tar.gz /
RUN mkdir -p /go/src/kubevirt.io/cpu-nfd-plugin && \
    tar -xzf /kubevirt-cpu-model-nfd-plugin-a1a283eb43db58b3df901935101ce0faca2ed56a.tar.gz --strip-components 1 \
        -C /go/src/kubevirt.io/cpu-nfd-plugin && \
    cd /go/src/kubevirt.io/cpu-nfd-plugin/cmd/cpu-nfd-plugin && \
    GOPROXY=off GOFLAGS=-mod=vendor go build -v

FROM ubi8-minimal:8.2-339
RUN mkdir -p /plugin/dest
COPY --from=builder \
     /go/src/kubevirt.io/cpu-nfd-plugin/cmd/cpu-nfd-plugin/cpu-nfd-plugin \
     /plugin/dest

LABEL com.redhat.component="kubevirt-cpu-model-nfd-plugin-container" \
      name="container-native-virtualization/kubevirt-cpu-model-nfd-plugin" \
      version="v2.4.0" \
      upstream-version="v0.1.1-4-ga1a283e" \
      summary="Node-feature-discovery plugin to get host supported cpu models and cpu features" \
      io.openshift.expose-services="" \
      io.openshift.tags="cnv,kubevirt,cpu" \
      io.k8s.display-name="kubevirt-cpu-model-nfd-plugin" \
      maintainer="The KubeVirt Project <kubevirt-dev@googlegroups.com>" \
      description="Node-feature-discovery plugin to get host supported cpu models and cpu features"
