FROM openshift/golang-builder:1.10 AS builder
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=1 OS_GIT_PATCH=41 OS_GIT_VERSION=4.1.41-202004130646-7137aa9 OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=7137aa9e3c31269cf62731faf0fde9804cf782a0 SOURCE_GIT_TAG=0.9.0-149-g7137aa9e SOURCE_GIT_URL=https://github.com/operator-framework/operator-lifecycle-manager SOURCE_DATE_EPOCH=1583936735 OS_GIT_COMMIT=7137aa9 BUILD_VERSION=v4.1.41 BUILD_RELEASE=202004130646
RUN yum update -y
RUN yum install -y make git

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

WORKDIR /go/src/github.com/operator-framework/operator-lifecycle-manager

# copy just enough of the git repo to parse HEAD, used to record version in OLM binaries
COPY .git/HEAD .git/HEAD
COPY .git/refs/heads/. .git/refs/heads
RUN mkdir -p .git/objects

COPY Makefile Makefile
COPY OLM_VERSION OLM_VERSION
COPY pkg pkg
COPY vendor vendor
COPY cmd cmd
COPY test test
RUN make build


FROM openshift/ose-base:v4.1.41.20200413.064634
ENV OS_GIT_MAJOR=4 OS_GIT_MINOR=1 OS_GIT_PATCH=41 OS_GIT_VERSION=4.1.41-202004130646-7137aa9 OS_GIT_TREE_STATE=clean SOURCE_GIT_COMMIT=7137aa9e3c31269cf62731faf0fde9804cf782a0 SOURCE_GIT_TAG=0.9.0-149-g7137aa9e SOURCE_GIT_URL=https://github.com/operator-framework/operator-lifecycle-manager SOURCE_DATE_EPOCH=1583936735 OS_GIT_COMMIT=7137aa9 BUILD_VERSION=v4.1.41 BUILD_RELEASE=202004130646

ADD manifests/ /manifests

# Copy the binary to a standard location where it will run.
COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-manager/bin/olm /bin/olm
COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-manager/bin/catalog /bin/catalog
COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-manager/bin/package-server /bin/package-server

# This image doesn't need to run as root user.
USER 1001

EXPOSE 8080
EXPOSE 5443

# Apply labels as needed. ART build automation fills in others required for
# shipping, including component NVR (name-version-release) and image name. OSBS
# applies others at build time. So most required labels need not be in the source.
#
# io.k8s.display-name is required and is displayed in certain places in the
# console (someone correct this if that's no longer the case)
#
# io.k8s.description is equivalent to "description" and should be defined per
# image; otherwise the parent image's description is inherited which is
# confusing at best when examining images.
#

LABEL \
        io.openshift.release.operator="true" \
        io.k8s.display-name="OpenShift Container Platform Operator Lifecycle Manager" \
        io.k8s.description="This is a component of OpenShift Container Platform and runs the Operator Lifecycle Manager" \
        maintainer="Odin Team <aos-odin@redhat.com>" \
        License="GPLv2+" \
        vendor="Red Hat" \
        name="openshift/ose-operator-lifecycle-manager" \
        com.redhat.component="operator-lifecycle-manager-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        version="v4.1.41" \
        release="202004130646" \
        io.openshift.build.commit.id="7137aa9e3c31269cf62731faf0fde9804cf782a0" \
        io.openshift.build.source-location="https://github.com/operator-framework/operator-lifecycle-manager" \
        io.openshift.build.commit.url="https://github.com/operator-framework/operator-lifecycle-manager/commit/7137aa9e3c31269cf62731faf0fde9804cf782a0"

