FROM rhel8/go-toolset:1.13.4 AS builder

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

FROM scratch

ENV NOP=/usr/local/bin/openshift-pipelines-nop \
    KO_APP=/ko-app \
    USER_UID=1001 \
    USER_NAME=openshift-pipelines-nop

COPY --from=builder /tmp/openshift-pipelines-nop ${NOP}
COPY --from=builder /tmp/openshift-pipelines-nop ${KO_APP}/nop

LABEL \
      com.redhat.component="openshift-pipelines-nop-rhel8-container" \
      name="openshift-pipelines-tech-preview/pipelines-nop-rhel8" \
      version="v1.2.2" \
      summary="Red Hat OpenShift Pipelines Nop" \
      maintainer="kbaig@redhat.com" \
      description="Red Hat OpenShift Pipelines Nop" \
      io.k8s.display-name="Red Hat OpenShift Pipelines Nop"

ENTRYPOINT ["/usr/local/bin/openshift-pipelines-nop"]
