FROM openshift/golang-builder:1.11 AS builder
ENV SOURCE_GIT_COMMIT=8bf0d9472acb65f1c5134d847f6a5f7e5258a5b3 SOURCE_DATE_EPOCH=1568299742 BUILD_VERSION=v4.2.10 SOURCE_GIT_URL=https://github.com/openshift/cluster-api-provider-libvirt SOURCE_GIT_TAG=v0.2.0-97-g8bf0d947 BUILD_RELEASE=201912022352
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.2.10.20191202.235209
ENV SOURCE_GIT_COMMIT=8bf0d9472acb65f1c5134d847f6a5f7e5258a5b3 SOURCE_DATE_EPOCH=1568299742 BUILD_VERSION=v4.2.10 SOURCE_GIT_URL=https://github.com/openshift/cluster-api-provider-libvirt SOURCE_GIT_TAG=v0.2.0-97-g8bf0d947 BUILD_RELEASE=201912022352
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/8bf0d9472acb65f1c5134d847f6a5f7e5258a5b3" \
        version="v4.2.10" \
        name="openshift/ose-libvirt-machine-controllers" \
        io.openshift.build.commit.id="8bf0d9472acb65f1c5134d847f6a5f7e5258a5b3" \
        release="201912022352" \
        io.openshift.build.source-location="https://github.com/openshift/cluster-api-provider-libvirt"

