FROM registry-proxy.engineering.redhat.com/rh-osbs/rhel8-go-toolset:1.15.7-4 AS builder
WORKDIR /opt/app-root/src/go/src/knative.dev/operator

COPY . .

ENV GOFLAGS="-mod=vendor"
RUN go build -o /tmp/operator ./cmd/operator
RUN cp -Lr /opt/app-root/src/go/src/knative.dev/operator/cmd/operator/kodata /tmp

FROM registry-proxy.engineering.redhat.com/rh-osbs/ubi8-minimal:8.3-298.1618432845
COPY --from=builder /tmp/operator /ko-app/operator
COPY --from=builder /tmp/kodata /var/run/ko

ENV KO_DATA_PATH="/var/run/ko"

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

ENTRYPOINT ["/ko-app/operator"]
