FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=dd3fc51a8b7f51da61643a6286eb0fecfa2d03cd SOURCE_DATE_EPOCH=1576180729 BUILD_VERSION=v4.3.0 SOURCE_GIT_URL=https://github.com/openshift/cluster-api-provider-libvirt SOURCE_GIT_TAG=v0.2.0-107-gdd3fc51a BUILD_RELEASE=202001211731
RUN yum install -y libvirt-devel

WORKDIR /go/src/github.com/openshift/cluster-api-provider-libvirt
COPY . .
RUN go build -o machine-controller-manager ./cmd/manager
RUN go build -o manager ./vendor/github.com/openshift/cluster-api/cmd/manager

FROM openshift/ose-base:v4.3.0.20200121.173126
ENV SOURCE_GIT_COMMIT=dd3fc51a8b7f51da61643a6286eb0fecfa2d03cd SOURCE_DATE_EPOCH=1576180729 BUILD_VERSION=v4.3.0 SOURCE_GIT_URL=https://github.com/openshift/cluster-api-provider-libvirt SOURCE_GIT_TAG=v0.2.0-107-gdd3fc51a BUILD_RELEASE=202001211731
RUN INSTALL_PKGS=" \
      libvirt-libs openssh-clients genisoimage \
      " && \
    yum install -y $INSTALL_PKGS && \
    rpm -V $INSTALL_PKGS && \
    yum clean all
COPY --from=builder /go/src/github.com/openshift/cluster-api-provider-libvirt/manager /
COPY --from=builder /go/src/github.com/openshift/cluster-api-provider-libvirt/machine-controller-manager /

LABEL \
        com.redhat.component="ose-libvirt-machine-controllers-container" \
        io.openshift.build.commit.url="https://github.com/openshift/cluster-api-provider-libvirt/commit/dd3fc51a8b7f51da61643a6286eb0fecfa2d03cd" \
        version="v4.3.0" \
        name="openshift/ose-libvirt-machine-controllers" \
        io.openshift.build.commit.id="dd3fc51a8b7f51da61643a6286eb0fecfa2d03cd" \
        release="202001211731" \
        io.openshift.build.source-location="https://github.com/openshift/cluster-api-provider-libvirt"

