#@follow_tag(registry.redhat.io/rhel8-2-els/rhel)
FROM registry.redhat.io/rhel8-2-els/rhel:8.2-18.1622668002 AS builder

ENV GOPATH=/go

RUN echo -e "[go-toolset]\nname=go-toolset\nprofiles=\nstate=enabled\nstream=rhel8" > /etc/dnf/modules.d/go-toolset.module \
    && dnf 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

#@follow_tag(registry.redhat.io/rhel8-2-els/rhel)
FROM registry.redhat.io/rhel8-2-els/rhel:8.2-18.1622668002
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.9" \
      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"
