FROM openshift/golang-builder:rhel_8_golang_1.16 AS builder
ENV __doozer=update BUILD_RELEASE=202111050611.p0.git.adc2e00.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-202111050611.p0.git.adc2e00.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=adc2e00 OS_GIT_VERSION=4.9.0-202111050611.p0.git.adc2e00.assembly.stream-adc2e00 SOURCE_DATE_EPOCH=1636089138 SOURCE_GIT_COMMIT=adc2e003df2751ee6ad7d93b93de36011af015c4 SOURCE_GIT_TAG=adc2e003 SOURCE_GIT_URL=https://github.com/openshift/console-operator 
WORKDIR /go/src/github.com/openshift/console-operator
COPY . .
ENV GO_PACKAGE github.com/openshift/console-operator
RUN go build -ldflags "-X $GO_PACKAGE/pkg/version.versionFromGit=$(git describe --long --tags --abbrev=7 --match 'v[0-9]*')" -tags="ocp" -o console ./cmd/console

FROM openshift/ose-base:v4.9.0-202111041612.p0.git.f93eca8.assembly.stream
ENV __doozer=update BUILD_RELEASE=202111050611.p0.git.adc2e00.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-202111050611.p0.git.adc2e00.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=adc2e00 OS_GIT_VERSION=4.9.0-202111050611.p0.git.adc2e00.assembly.stream-adc2e00 SOURCE_DATE_EPOCH=1636089138 SOURCE_GIT_COMMIT=adc2e003df2751ee6ad7d93b93de36011af015c4 SOURCE_GIT_TAG=adc2e003 SOURCE_GIT_URL=https://github.com/openshift/console-operator 
RUN useradd console-operator
USER console-operator
COPY --from=builder /go/src/github.com/openshift/console-operator/console /usr/bin/console

# these manifests are necessary for the installer
COPY manifests /manifests/

# out-of-the-box quickstarts
COPY quickstarts/*.yaml /manifests/

# extensions manifests generated from openshift/api types
COPY vendor/github.com/openshift/api/console/v1/*.yaml /manifests/
COPY vendor/github.com/openshift/api/console/v1alpha1/*.yaml /manifests/
COPY vendor/github.com/openshift/api/operator/v1/0000_70_console-operator.crd.yaml /manifests/
COPY vendor/github.com/openshift/api/helm/v1beta1/0000_10-helm-chart-repository.crd.yaml /manifests/



# entrypoint specified in 03-operator.yaml as `console-operator`
# CMD ["/usr/bin/console", "operator", "--kubeconfig", "path/to/config", "--config", "./install/config.yaml", "--v", "4"]
# CMD ["/usr/bin/console", "operator", "--v", "4"]

LABEL \
        io.k8s.display-name="OpenShift console-operator" \
        io.k8s.description="This is a component of OpenShift Container Platform and manages the lifecycle of the web console." \
        io.openshift.tags="openshift" \
        maintainer="Jakub Hadvig <jhadvig@redhat.com>" \
        io.openshift.release.operator="true" \
        name="openshift/ose-console-operator" \
        com.redhat.component="openshift-enterprise-console-operator-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Management Console" \
        release="202111050611.p0.git.adc2e00.assembly.stream" \
        io.openshift.build.commit.id="adc2e003df2751ee6ad7d93b93de36011af015c4" \
        io.openshift.build.source-location="https://github.com/openshift/console-operator" \
        io.openshift.build.commit.url="https://github.com/openshift/console-operator/commit/adc2e003df2751ee6ad7d93b93de36011af015c4" \
        version="v4.9.0"

