FROM openshift/golang-builder:1.13 AS builder
ENV __doozer=update BUILD_RELEASE=202007240519.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202007240519.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=89d6eb4 OS_GIT_VERSION=4.5.0-202007240519.p0-89d6eb4 SOURCE_DATE_EPOCH=1586869454 SOURCE_GIT_COMMIT=89d6eb4bb6cd99a172f8b51d924c5d711944f0ae SOURCE_GIT_TAG=89d6eb4 SOURCE_GIT_URL=https://github.com/openshift/linuxptp-daemon 
ADD . /usr/src/linuxptp-daemon

WORKDIR /usr/src/linuxptp-daemon
ENV GO111MODULE=off
RUN make clean && make

FROM openshift/ose-base:v4.5.0.20200724.062710
ENV __doozer=update BUILD_RELEASE=202007240519.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202007240519.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=89d6eb4 OS_GIT_VERSION=4.5.0-202007240519.p0-89d6eb4 SOURCE_DATE_EPOCH=1586869454 SOURCE_GIT_COMMIT=89d6eb4bb6cd99a172f8b51d924c5d711944f0ae SOURCE_GIT_TAG=89d6eb4 SOURCE_GIT_URL=https://github.com/openshift/linuxptp-daemon 
RUN yum -y update && yum --setopt=skip_missing_names_on_install=False -y install linuxptp ethtool hwdata && yum clean all
COPY --from=builder /usr/src/linuxptp-daemon/bin/ptp /usr/local/bin/

CMD ["/usr/local/bin/ptp"]

LABEL \
        name="openshift/ose-ptp" \
        com.redhat.component="ose-linuxptp-daemon-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        io.openshift.maintainer.subcomponent="ptp" \
        release="202007240519.p0" \
        io.openshift.build.commit.id="89d6eb4bb6cd99a172f8b51d924c5d711944f0ae" \
        io.openshift.build.source-location="https://github.com/openshift/linuxptp-daemon" \
        io.openshift.build.commit.url="https://github.com/openshift/linuxptp-daemon/commit/89d6eb4bb6cd99a172f8b51d924c5d711944f0ae" \
        version="v4.5.0"

