FROM openshift/golang-builder:1.11 AS builder
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=2 OS_GIT_PATCH=22 OS_GIT_VERSION=4.2.22-202003020552-e57c108 OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=e57c108a91c48296c095ae19e006a37166a9684e SOURCE_GIT_TAG=e57c108 SOURCE_GIT_URL=https://github.com/openshift/cluster-nfd-operator SOURCE_DATE_EPOCH=1581734266 OS_GIT_COMMIT=e57c108 BUILD_VERSION=v4.2.22 BUILD_RELEASE=202003020552
WORKDIR /go/src/github.com/openshift/cluster-nfd-operator
COPY . .
RUN make build

FROM openshift/ose-base:v4.2.22.20200302.055253
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=2 OS_GIT_PATCH=22 OS_GIT_VERSION=4.2.22-202003020552-e57c108 OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=e57c108a91c48296c095ae19e006a37166a9684e SOURCE_GIT_TAG=e57c108 SOURCE_GIT_URL=https://github.com/openshift/cluster-nfd-operator SOURCE_DATE_EPOCH=1581734266 OS_GIT_COMMIT=e57c108 BUILD_VERSION=v4.2.22 BUILD_RELEASE=202003020552
ARG CSV=4.2
COPY --from=builder /go/src/github.com/openshift/cluster-nfd-operator/cluster-nfd-operator /usr/bin/

RUN mkdir -p /opt/nfd
COPY assets /opt/nfd

#ADD controller-manifests /manifests
COPY manifests/olm-catalog/$CSV /manifests/$CSV
COPY manifests/olm-catalog/nfd.package.yaml /manifests/

RUN useradd cluster-nfd-operator
USER cluster-nfd-operator
ENTRYPOINT ["/usr/bin/cluster-nfd-operator"]

LABEL \
        io.k8s.display-name="OpenShift cluster-nfd-operator" \
        io.k8s.description="This is a component of OpenShift and manages the node feature discovery." \
        io.openshift.tags="openshift" \
        com.redhat.delivery.appregistry="false" \
        maintainer="ATS Auto Tuning Scalability  <aos-scalability@redhat.com>" \
        name="openshift/ose-cluster-nfd-operator" \
        com.redhat.component="cluster-nfd-operator-container" \
        version="v4.2.22" \
        release="202003020552" \
        io.openshift.build.commit.id="e57c108a91c48296c095ae19e006a37166a9684e" \
        io.openshift.build.source-location="https://github.com/openshift/cluster-nfd-operator" \
        io.openshift.build.commit.url="https://github.com/openshift/cluster-nfd-operator/commit/e57c108a91c48296c095ae19e006a37166a9684e"

