FROM openshift/golang-builder:rhel_8_golang_1.16 AS builder
ENV __doozer=update BUILD_RELEASE=202110262219.p0.git.a140e2e.assembly.stream BUILD_VERSION=v4.8.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=8 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.8.0-202110262219.p0.git.a140e2e.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=a140e2e OS_GIT_VERSION=4.8.0-202110262219.p0.git.a140e2e.assembly.stream-a140e2e SOURCE_DATE_EPOCH=1632428677 SOURCE_GIT_COMMIT=a140e2ec73661c345be197c318ff1f8733cc5b1f SOURCE_GIT_TAG=a140e2ec 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.8.0.20211026.222920
ENV __doozer=update BUILD_RELEASE=202110262219.p0.git.a140e2e.assembly.stream BUILD_VERSION=v4.8.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=8 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.8.0-202110262219.p0.git.a140e2e.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=a140e2e OS_GIT_VERSION=4.8.0-202110262219.p0.git.a140e2e.assembly.stream-a140e2e SOURCE_DATE_EPOCH=1632428677 SOURCE_GIT_COMMIT=a140e2ec73661c345be197c318ff1f8733cc5b1f SOURCE_GIT_TAG=a140e2ec 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="202110262219.p0.git.a140e2e.assembly.stream" \
        io.openshift.build.commit.id="a140e2ec73661c345be197c318ff1f8733cc5b1f" \
        io.openshift.build.source-location="https://github.com/openshift/console-operator" \
        io.openshift.build.commit.url="https://github.com/openshift/console-operator/commit/a140e2ec73661c345be197c318ff1f8733cc5b1f" \
        version="v4.8.0"

