FROM rhel8/go-toolset:1.13.4 AS builder
WORKDIR /opt/app-root/src/go/src/github.com/openshift-knative/serverless-operator/knative-operator
COPY . .
ENV GOFLAGS="-mod=vendor"
RUN go build -o /tmp/manager ./cmd/manager

FROM ubi8-minimal:8-released
ENV OPERATOR=/usr/local/bin/knative-openshift \
    USER_UID=1001 \
    USER_NAME=knative-openshift
COPY --from=builder /tmp/manager ${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-knative-rhel8-operator-container" \
      name="openshift-serverless-1/knative-rhel8-operator" \
      version="1.7.2" \
      summary="Red Hat OpenShift Serverless 1 Knative Operator" \
      maintainer="serverless-support@redhat.com" \
      description="Red Hat OpenShift Serverless 1 Knative Operator" \
      io.k8s.display-name="Red Hat OpenShift Serverless 1 Knative Operator"

ENTRYPOINT ["/usr/local/bin/entrypoint"]
USER ${USER_UID}
