FROM openshift/golang-builder:rhel_8_golang_1.16 AS builder
ENV __doozer=update BUILD_RELEASE=202110210030.p0.git.16c9c6f.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202110210030.p0.git.16c9c6f.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge KUBE_GIT_COMMIT=16c9c6f50f4bfde4241d18fd4eebcbf7a8b47f91 KUBE_GIT_MAJOR=1 KUBE_GIT_MINOR=11+ KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.11.7-beta.0.0.20181219023948-b875d52ea96d+16c9c6f OS_GIT_COMMIT=16c9c6f OS_GIT_VERSION=4.9.0-202110210030.p0.git.16c9c6f.assembly.stream-16c9c6f SOURCE_DATE_EPOCH=1634775310 SOURCE_GIT_COMMIT=16c9c6f50f4bfde4241d18fd4eebcbf7a8b47f91 SOURCE_GIT_TAG=16c9c6f SOURCE_GIT_URL=https://github.com/openshift/linuxptp-daemon 
WORKDIR /go/src/github.com/openshift/linuxptp-daemon
COPY . .
RUN make clean && make

FROM openshift/ose-base:v4.9.0-202110182323.p0.git.f93eca8.assembly.stream
ENV __doozer=update BUILD_RELEASE=202110210030.p0.git.16c9c6f.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202110210030.p0.git.16c9c6f.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge KUBE_GIT_COMMIT=16c9c6f50f4bfde4241d18fd4eebcbf7a8b47f91 KUBE_GIT_MAJOR=1 KUBE_GIT_MINOR=11+ KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.11.7-beta.0.0.20181219023948-b875d52ea96d+16c9c6f OS_GIT_COMMIT=16c9c6f OS_GIT_VERSION=4.9.0-202110210030.p0.git.16c9c6f.assembly.stream-16c9c6f SOURCE_DATE_EPOCH=1634775310 SOURCE_GIT_COMMIT=16c9c6f50f4bfde4241d18fd4eebcbf7a8b47f91 SOURCE_GIT_TAG=16c9c6f 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 /go/src/github.com/openshift/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="202110210030.p0.git.16c9c6f.assembly.stream" \
        io.openshift.build.commit.id="16c9c6f50f4bfde4241d18fd4eebcbf7a8b47f91" \
        io.openshift.build.source-location="https://github.com/openshift/linuxptp-daemon" \
        io.openshift.build.commit.url="https://github.com/openshift/linuxptp-daemon/commit/16c9c6f50f4bfde4241d18fd4eebcbf7a8b47f91" \
        version="v4.9.0"

