#@follow_tag(openshift-golang-builder:1.12)
FROM openshift/golang-builder:v1.12.12-7 AS builder

ENV GOPATH=/go

# Catch US Dockerfile changes that need to be propagated DS
ENV US_DOCKERFILE_MD5=0aadb260162f1798a7fadba10aa14ccc

COPY hostpath-provisioner-operator-*.tar.gz /
RUN mkdir -p /go/src/kubevirt.io/hostpath-provisioner-operator && \
    tar -xzf hostpath-provisioner-operator-*.tar.gz --strip-components 1 \
        -C /go/src/kubevirt.io/hostpath-provisioner-operator && \
    cd /go/src/kubevirt.io/hostpath-provisioner-operator && \
    echo "$US_DOCKERFILE_MD5  ./Dockerfile" > .md5sums && \
    md5sum -c .md5sums && rm .md5sums && \
    echo "v2.2.0" > version.txt && \
    make operator csv-generator

#@follow_tag(ubi8-minimal:8-released)
FROM ubi8-minimal:8.1-279
COPY --from=builder /go/src/kubevirt.io/hostpath-provisioner-operator/_out/hostpath-provisioner-operator /usr/bin/hostpath-provisioner-operator
COPY --from=builder /go/src/kubevirt.io/hostpath-provisioner-operator/version.txt /version.txt
COPY --from=builder /go/src/kubevirt.io/hostpath-provisioner-operator/_out/csv-generator /usr/bin/csv-generator
ENTRYPOINT [ "/usr/bin/hostpath-provisioner-operator" ]

LABEL com.redhat.component="hostpath-provisioner-operator-container" \
      name="container-native-virtualization/hostpath-provisioner-rhel8-operator" \
      version="v2.2.0" \
      release="11" \
      summary="Container-native virtualization hostpath-provisioner-operator" \
      io.openshift.expose-services="" \
      io.openshift.tags="data,images" \
      io.k8s.display-name="hostpath-provisioner-operator" \
      maintainer="alitke@redhat.com" \
      description="Container-native virtualization hostpath-provisioner-operator"
