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

RUN dnf install -y tar gzip

COPY vm-import-operator-919d989be347d2bb6ee84132a20567b861a3b82a.tar.gz /
RUN tar -xvzf vm-import-operator-919d989be347d2bb6ee84132a20567b861a3b82a.tar.gz

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

RUN mkdir /disks && \
    echo -e "[virt]\nname=virt\nprofiles=\nstate=enabled\nstream=8.2" > /etc/dnf/modules.d/virt.module && \
    echo -e "[llvm-toolset]\nname=llvm-toolset\nprofiles=\nstate=enabled\nstream=rhel8" > /etc/dnf/modules.d/llvm-toolset.module && \
    dnf -y update && \
    rm -rf /var/cache/yum && \
    dnf install -y \
        qemu-guest-agent \
        qemu-img \
        qemu-kvm \
        virt-v2v \
        virtio-win && \
    dnf clean all

ENV LIBGUESTFS_BACKEND=direct

COPY --from=builder vm-import-operator-919d989be347d2bb6ee84132a20567b861a3b82a/build/virtv2v/bin/entrypoint /usr/bin/entrypoint

ENTRYPOINT ["/usr/bin/entrypoint"]

LABEL com.redhat.component="vm-import-virtv2v-container" \
      name="container-native-virtualization/vm-import-virtv2v-rhel8" \
      version="v2.5.2" \
      release="5" \
      upstream-version="0.2.5-25-g919d989" \
      upstream-vcs-ref="919d989be347d2bb6ee84132a20567b861a3b82a" \
      upstream-vcs-type="git" \
      summary="VM Import Operator - virt-v2v" \
      io.openshift.expose-services="" \
      io.openshift.tags="cnv,kubevirt,operator,vmware,import" \
      io.k8s.display-name="vm-import-virtv2v" \
      maintainer="marnold@redhat.com,fdupont@redhat.com,pkliczew@redhat.com" \
      description="CNV VM Import virt-v2v"
