FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=ea390b2345ff653a98ab7b5c65f6b907edef4e4b SOURCE_DATE_EPOCH=1568951293 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/console-operator SOURCE_GIT_TAG=ea390b23 BUILD_RELEASE=201910101614
WORKDIR /go/src/github.com/openshift/console-operator
COPY . .
RUN ADDITIONAL_GOTAGS="ocp" make build WHAT="cmd/console"; \
    mkdir -p /tmp/build; \
    cp /go/src/github.com/openshift/console-operator/_output/local/bin/linux/$(go env GOARCH)/console /tmp/build/console

FROM openshift/ose-base:v4.2.0.20191010.161456
ENV SOURCE_GIT_COMMIT=ea390b2345ff653a98ab7b5c65f6b907edef4e4b SOURCE_DATE_EPOCH=1568951293 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/console-operator SOURCE_GIT_TAG=ea390b23 BUILD_RELEASE=201910101614
RUN useradd console-operator
USER console-operator
COPY --from=builder /tmp/build/console /usr/bin/console

# these manifests are necessary for the installer
COPY manifests /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.description="This is a component of OpenShift Container Platform and manages the lifecycle of the web console." \
        com.redhat.component="openshift-enterprise-console-operator-container" \
        maintainer="Benjamin A. Petersen <bpetersen@redhat.com>" \
        name="openshift/ose-console-operator" \
        io.k8s.display-name="OpenShift console-operator" \
        io.openshift.build.source-location="https://github.com/openshift/console-operator" \
        io.openshift.release.operator="true" \
        io.openshift.build.commit.url="https://github.com/openshift/console-operator/commit/ea390b2345ff653a98ab7b5c65f6b907edef4e4b" \
        version="v4.2.0" \
        io.openshift.build.commit.id="ea390b2345ff653a98ab7b5c65f6b907edef4e4b" \
        release="201910101614" \
        io.openshift.tags="openshift"

