FROM rhel8/go-toolset:1.12.8 AS builder
WORKDIR /opt/app-root/src/go/src/github.com/openshift-knative/knative-serving-operator
COPY . .
RUN go build -o /tmp/knative-serving-operator ./cmd/manager

FROM ubi8:8-released

ENV OPERATOR=/usr/local/bin/knative-serving-operator \
    USER_UID=1001 \
    USER_NAME=knative-serving-operator

# install operator binary
COPY --from=builder /tmp/knative-serving-operator ${OPERATOR}

COPY build/bin /usr/local/bin
RUN  /usr/local/bin/user_setup

# install manifest[s]
COPY deploy /deploy

COPY deploy/olm-catalog/knative-serving-operator/0.7.1 /manifests/0.7.1
COPY deploy/olm-catalog/knative-serving-operator/knative-serving-operator.package.yaml /manifests

LABEL \
      com.redhat.component="openshift-serverless-1-tech-preview-serving-rhel8-operator-container" \
      name="openshift-serverless-1-tech-preview/serving-rhel8-operator" \
      version="0.7.1" \
      summary="Red Hat OpenShift Serverless 1 Serving Operator" \
      maintainer="mthoemme@redhat.com" \
      description="Red Hat OpenShift Serverless 1 Serving Operator" \
      io.k8s.display-name="Red Hat OpenShift Serverless 1 Serving Operator"

ENTRYPOINT ["/usr/local/bin/entrypoint"]

USER ${USER_UID}
