FROM openshift/golang-builder:rhel_8_golang_1.16 AS builder
ENV __doozer=update BUILD_RELEASE=202110182323.p0.git.6bb5cd3.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-202110182323.p0.git.6bb5cd3.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=6bb5cd3 OS_GIT_VERSION=4.9.0-202110182323.p0.git.6bb5cd3.assembly.stream-6bb5cd3 SOURCE_DATE_EPOCH=1633374629 SOURCE_GIT_COMMIT=6bb5cd3ff080c350030a1cde1424f16ccfb8927b SOURCE_GIT_TAG=6bb5cd3 SOURCE_GIT_URL=https://github.com/redhat-cne/cloud-event-proxy 
ENV GO111MODULE=off
ENV CGO_ENABLED=1
ENV COMMON_GO_ARGS=-race
ENV GOOS=linux
ENV GOPATH=/go

WORKDIR /go/src/github.com/redhat-cne/cloud-event-proxy
COPY . .

RUN hack/build-go.sh

FROM openshift/ose-base:v4.9.0.20211018.233142 AS bin
ENV __doozer=update BUILD_RELEASE=202110182323.p0.git.6bb5cd3.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-202110182323.p0.git.6bb5cd3.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=6bb5cd3 OS_GIT_VERSION=4.9.0-202110182323.p0.git.6bb5cd3.assembly.stream-6bb5cd3 SOURCE_DATE_EPOCH=1633374629 SOURCE_GIT_COMMIT=6bb5cd3ff080c350030a1cde1424f16ccfb8927b SOURCE_GIT_TAG=6bb5cd3 SOURCE_GIT_URL=https://github.com/redhat-cne/cloud-event-proxy 
COPY --from=builder /go/src/github.com/redhat-cne/cloud-event-proxy/build/cloud-event-proxy /
COPY --from=builder /go/src/github.com/redhat-cne/cloud-event-proxy/plugins/*.so /plugins/


ENTRYPOINT ["./cloud-event-proxy"]

LABEL \
        io.k8s.display-name="Cloud Event Proxy" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides a side car to handle cloud events." \
        io.openshift.tags="openshift" \
        maintainer="Aneesh Puttur <aputtur@redhat.com>" \
        name="openshift/ose-cloud-event-proxy" \
        com.redhat.component="cloud-event-proxy-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Cloud Native Events" \
        io.openshift.maintainer.subcomponent="Cloud Event Proxy" \
        release="202110182323.p0.git.6bb5cd3.assembly.stream" \
        io.openshift.build.commit.id="6bb5cd3ff080c350030a1cde1424f16ccfb8927b" \
        io.openshift.build.source-location="https://github.com/redhat-cne/cloud-event-proxy" \
        io.openshift.build.commit.url="https://github.com/redhat-cne/cloud-event-proxy/commit/6bb5cd3ff080c350030a1cde1424f16ccfb8927b" \
        version="v4.9.0"

