FROM openshift/golang-builder:1.10 AS builder
ENV SOURCE_GIT_COMMIT=b45dae333aa3d6e4baa8fb8625eac5d7700c6525 SOURCE_DATE_EPOCH=1561652501 BUILD_VERSION=v4.1.10 SOURCE_GIT_URL=https://github.com/operator-framework/operator-lifecycle-manager SOURCE_GIT_TAG=0.9.0-106-gb45dae3 BUILD_RELEASE=201908061216
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.10.20190806.121629
ENV SOURCE_GIT_COMMIT=b45dae333aa3d6e4baa8fb8625eac5d7700c6525 SOURCE_DATE_EPOCH=1561652501 BUILD_VERSION=v4.1.10 SOURCE_GIT_URL=https://github.com/operator-framework/operator-lifecycle-manager SOURCE_GIT_TAG=0.9.0-106-gb45dae3 BUILD_RELEASE=201908061216

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

