FROM rhel8/go-toolset:1.13.4 AS builder

WORKDIR /opt/app-root/src/go/src/github.com/tektoncd/triggers
COPY . .
RUN CGO_ENABLED=0 \
    go build -mod=vendor -v -o /tmp/openshift-pipelines-triggers-controller \
    ./cmd/controller

FROM ubi8-minimal:8-released

ENV CONTROLLER=/usr/local/bin/openshift-pipelines-triggers-controller \
    KO_APP=/ko-app \
    USER_UID=1001 \
    USER_NAME=openshift-pipelines-triggers-controller

COPY --from=builder /tmp/openshift-pipelines-triggers-controller ${CONTROLLER}
COPY --from=builder /tmp/openshift-pipelines-triggers-controller ${KO_APP}/controller

LABEL \
      com.redhat.component="openshift-pipelines-triggers-controller-rhel-8-container" \
      name="openshift-pipelines-tech-preview/pipelines-triggers-controller-rhel8" \
      version="v1.1.0" \
      summary="Red Hat OpenShift Pipelines Triggers Controller" \
      maintainer="vdemeest@redhat.com" \
      description="Red Hat OpenShift Pipelines Triggers Controller" \
      io.k8s.display-name="Red Hat OpenShift Pipelines Triggers Controller"

ENTRYPOINT ["/usr/local/bin/openshift-pipelines-triggers-controller"]
