FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=d5bb4c0889ee6c57675def821103f42f6eefcd35 SOURCE_DATE_EPOCH=1568970172 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/baremetal-runtimecfg SOURCE_GIT_TAG=d5bb4c0 BUILD_RELEASE=201910101614
WORKDIR /go/src/github.com/openshift/baremetal-runtimecfg
COPY . .
RUN GO111MODULE=on go build --mod=vendor cmd/runtimecfg/runtimecfg.go
RUN GO111MODULE=on go build --mod=vendor cmd/dynkeepalived/dynkeepalived.go
RUN GO111MODULE=on go build --mod=vendor cmd/monitor/monitor.go

FROM openshift/ose-base:v4.2.0.20191010.161456
ENV SOURCE_GIT_COMMIT=d5bb4c0889ee6c57675def821103f42f6eefcd35 SOURCE_DATE_EPOCH=1568970172 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/baremetal-runtimecfg SOURCE_GIT_TAG=d5bb4c0 BUILD_RELEASE=201910101614
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/runtimecfg /usr/bin/
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/monitor /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/dynkeepalived /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/scripts/iptables /usr/bin

ENTRYPOINT ["/usr/bin/runtimecfg"]

LABEL \
        io.k8s.description="Retrieves Node and Cluster information for baremetal network config" \
        com.redhat.component="ose-baremetal-runtimecfg-container" \
        maintainer="Antoni Segura Puimedon <antoni@redhat.com>" \
        name="openshift/ose-baremetal-runtimecfg" \
        io.k8s.display-name="baremetal-runtimecfg" \
        io.openshift.build.source-location="https://github.com/openshift/baremetal-runtimecfg" \
        io.openshift.build.commit.url="https://github.com/openshift/baremetal-runtimecfg/commit/d5bb4c0889ee6c57675def821103f42f6eefcd35" \
        version="v4.2.0" \
        io.openshift.build.commit.id="d5bb4c0889ee6c57675def821103f42f6eefcd35" \
        release="201910101614"

