#@follow_tag(registry.redhat.io/rhel8-2-els/rhel)
FROM registry.redhat.io/rhel8-2-els/rhel:8.2-13 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 ovs-cni-*.tar.gz /go/src/github.com/kubevirt/
RUN \
    cd /go/src/github.com/kubevirt/ && \
    tar -xzf ovs-cni-*.tar.gz && \
    rm ovs-cni-*.tar.gz && \
    mv ovs-cni-* ovs-cni

WORKDIR /go/src/github.com/kubevirt/ovs-cni/

RUN \
    GOOS=linux \
    GOARCH=amd64 \
    CGO_ENABLED=0 \
    GOFLAGS=-mod=vendor \
    go build -tags no_openssl -i -o /ovs ./cmd/plugin

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

COPY --from=builder /ovs /ovs

LABEL com.redhat.component="ovs-cni-plugin-container" \
      name="container-native-virtualization/ovs-cni-plugin" \
      version="v2.5.5" \
      summary="OVS CNI Plugin" \
      io.openshift.expose-services="" \
      io.openshift.tags="cnv,cni,ovs" \
      io.k8s.display-name="ovs-cni-plugin" \
      maintainer="phoracek@redhat.com" \
      description="OVS CNI Plugin"
