FROM openshift/golang-builder:1.11 AS builder
ENV SOURCE_GIT_COMMIT=a2a477909c1d518ef7cf28601e5d7db56a4d4069 SOURCE_DATE_EPOCH=1566409549 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/cluster-api-provider-baremetal SOURCE_GIT_TAG=a2a47790 BUILD_RELEASE=201910101614
WORKDIR /go/src/github.com/metal3-io/cluster-api-provider-baremetal
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.0.20191010.161456
ENV SOURCE_GIT_COMMIT=a2a477909c1d518ef7cf28601e5d7db56a4d4069 SOURCE_DATE_EPOCH=1566409549 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/cluster-api-provider-baremetal SOURCE_GIT_TAG=a2a47790 BUILD_RELEASE=201910101614
#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/metal3-io/cluster-api-provider-baremetal/manager /
COPY --from=builder /go/src/github.com/metal3-io/cluster-api-provider-baremetal/machine-controller-manager /

LABEL \
        com.redhat.component="baremetal-machine-controller-container" \
        io.openshift.build.commit.url="https://github.com/openshift/cluster-api-provider-baremetal/commit/a2a477909c1d518ef7cf28601e5d7db56a4d4069" \
        version="v4.2.0" \
        name="openshift/ose-baremetal-machine-controllers" \
        io.openshift.build.commit.id="a2a477909c1d518ef7cf28601e5d7db56a4d4069" \
        release="201910101614" \
        io.openshift.build.source-location="https://github.com/openshift/cluster-api-provider-baremetal"

