FROM registry.redhat.io/ubi8/go-toolset:1.14.12 AS builder

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

COPY . .

ENV GOFLAGS="-mod=vendor"
RUN go build -o /tmp/knative-openshift-ingress ./cmd/manager

FROM registry.redhat.io/ubi8/ubi-minimal

ENV OPERATOR=/usr/local/bin/knative-openshift-ingress \
    USER_UID=1001 \
    USER_NAME=knative-openshift-ingress

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

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

LABEL \
      com.redhat.component="openshift-serverless-1-ingress-rhel8-operator-container" \
      name="openshift-serverless-1/ingress-rhel8-operator" \
      version="1.10.1" \
      summary="Red Hat OpenShift Serverless 1 Ingress Operator" \
      maintainer="serverless-support@redhat.com" \
      description="Red Hat OpenShift Serverless 1 Ingress Operator" \
      io.k8s.display-name="Red Hat OpenShift Serverless 1 Ingress Operator"

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

USER ${USER_UID}
