FROM openshift/golang-builder:rhel_8_golang_1.15 AS builder
ENV __doozer=update BUILD_RELEASE=202106021513.p0.git.a6d621b BUILD_VERSION=v4.6.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=6 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.6.0-202106021513.p0.git.a6d621b SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=a6d621b OS_GIT_VERSION=4.6.0-202106021513.p0.git.a6d621b-a6d621b SOURCE_DATE_EPOCH=1621568716 SOURCE_GIT_COMMIT=a6d621b2f7a75c0a4b265b22d6d7665c5cce9a92 SOURCE_GIT_TAG=a6d621b SOURCE_GIT_URL=https://github.com/openshift/baremetal-runtimecfg 
WORKDIR /go/src/github.com/openshift/baremetal-runtimecfg
COPY . .
RUN GO111MODULE=on go build --mod=vendor -o runtimecfg ./cmd/runtimecfg
RUN GO111MODULE=on go build --mod=vendor cmd/dynkeepalived/dynkeepalived.go
RUN GO111MODULE=on go build --mod=vendor cmd/corednsmonitor/corednsmonitor.go
RUN GO111MODULE=on go build --mod=vendor cmd/monitor/monitor.go
RUN GO111MODULE=on go build --mod=vendor cmd/unicastipserver/unicastipserver.go

FROM openshift/ose-base:v4.6.0.20210602.153339
ENV __doozer=update BUILD_RELEASE=202106021513.p0.git.a6d621b BUILD_VERSION=v4.6.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=6 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.6.0-202106021513.p0.git.a6d621b SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=a6d621b OS_GIT_VERSION=4.6.0-202106021513.p0.git.a6d621b-a6d621b SOURCE_DATE_EPOCH=1621568716 SOURCE_GIT_COMMIT=a6d621b2f7a75c0a4b265b22d6d7665c5cce9a92 SOURCE_GIT_TAG=a6d621b SOURCE_GIT_URL=https://github.com/openshift/baremetal-runtimecfg 

RUN yum install -y dhclient diffutils && yum clean all

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/corednsmonitor /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/unicastipserver /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/scripts/* /usr/bin/
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/scripts/ip*tables /usr/sbin/

ENTRYPOINT ["/usr/bin/runtimecfg"]

LABEL \
        io.k8s.display-name="baremetal-runtimecfg" \
        io.k8s.description="Retrieves Node and Cluster information for baremetal network config" \
        maintainer="Antoni Segura Puimedon <antoni@redhat.com>" \
        name="openshift/ose-baremetal-runtimecfg" \
        com.redhat.component="ose-baremetal-runtimecfg-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        io.openshift.maintainer.subcomponent="runtime-cfg" \
        release="202106021513.p0.git.a6d621b" \
        io.openshift.build.commit.id="a6d621b2f7a75c0a4b265b22d6d7665c5cce9a92" \
        io.openshift.build.source-location="https://github.com/openshift/baremetal-runtimecfg" \
        io.openshift.build.commit.url="https://github.com/openshift/baremetal-runtimecfg/commit/a6d621b2f7a75c0a4b265b22d6d7665c5cce9a92" \
        version="v4.6.0"

