FROM rhel8/go-toolset:1.13.4 AS builder

WORKDIR /opt/app-root/src/go/src/github.com/openshift-knative/serverless-operator/serving/operator

COPY . .
RUN go build -o /tmp/knative-serving-operator ./cmd/manager

FROM ubi8-minimal: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

LABEL \
      com.redhat.component="openshift-serverless-1-tech-preview-serving-rhel8-operator-container" \
      name="openshift-serverless-1-tech-preview/serving-rhel8-operator" \
      version="v1.3.0" \
      summary="Red Hat OpenShift Serverless 1 Serving Operator" \
      maintainer="wvanwinc@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}
