#@follow_tag(openshift-golang-builder:1.13)
FROM openshift-golang-builder:v1.13.4-2 AS builder

ENV GOPATH=/go

ARG upstream_version=${CI_UPSTREAM_VERSION}
ARG upstream_commit=${CI_UPSTREAM_COMMIT}
ARG archive=${CI_ARCHIVE_PERFORMANCE_ADDON_OPERATORS}
ARG project_dir=${GOPATH}/src/github.com/openshift-kni/performance-addon-operators

COPY ${archive} /

RUN mkdir -p ${project_dir} && tar -xzf /${archive} --strip-components 1 -C ${project_dir}
WORKDIR ${project_dir}

RUN make dist

#@follow_tag(ubi8-minimal:8-released)
FROM ubi8-minimal:8.1-407

COPY --from=builder ${project_dir}/build/assets /assets
COPY --from=builder ${project_dir}/build/_output/bin/performance-addon-operators /bin/performance-operator

ENTRYPOINT ["/bin/performance-operator"]

LABEL com.redhat.component="performance-addon-operator-container" \
      name="openshift4/performance-addon-rhel8-operator" \
      version="${CI_CONTAINER_VERSION}" \
      release="${CI_CONTAINER_RELEASE}" \
      upstream-version="${CI_UPSTREAM_VERSION}" \
      upstream-vcs-ref="${CI_UPSTREAM_COMMIT}" \
      upstream-vcs-type="git" \
      summary="performance-addon-operator" \
      io.openshift.expose-services="" \
      io.openshift.tags="operator" \
      io.k8s.display-name="performance-addon-operator" \
      maintainer="openshift-operators@redhat.com" \
      description="performance-addon-operator"
