FROM rhel8/go-toolset:1.13.4 AS builder

WORKDIR /opt/app-root/src/github.com/openshift/tektoncd-pipeline-operator
COPY . .
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux \
    go build  -mod=vendor -o /tmp/openshift-pipelines-operator \
    ./cmd/manager

FROM ubi8-minimal:8-released

ENV OPERATOR=/usr/local/bin/openshift-pipelines-operator \
    USER_UID=1001 \
    USER_NAME=openshift-pipelines-operator

COPY --from=builder /tmp/openshift-pipelines-operator ${OPERATOR}
COPY build/bin /usr/local/bin
RUN /usr/local/bin/user_setup
COPY deploy/resources /deploy/resources
RUN cat /proc/sys/kernel/random/uuid > /deploy/uuid
LABEL \
      com.redhat.component="openshift-pipelines-rhel8-operator-container" \
      name="openshift-pipelines-tech-preview/pipelines-rhel8-operator" \
      version="v1.1.0" \
      summary="Red Hat OpenShift Pipelines Operator" \
      maintainer="hshinde@redhat.com" \
      description="Red Hat OpenShift Pipelines Operator" \
      io.k8s.display-name="Red Hat OpenShift Pipelines Operator"

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

USER ${USER_UID}
