FROM quay.io/operator-framework/upstream-registry-builder

# 9.9.9 points to the templated manifests for CI
ARG OPERATOR_VERSION_NEXT=9.9.9
ARG REG_URL=registry.build01.ci.openshift.org

USER root
RUN mkdir -p /tmp/manifests
COPY manifests/node-maintenance-operator/v"${OPERATOR_VERSION_NEXT}" /tmp/manifests/

# Replace template vars when in CI
RUN find /tmp/manifests/ -type f -exec sed -i "s|IMAGE_REGISTRY/OPERATOR_IMAGE:IMAGE_TAG|${REG_URL}/${OPENSHIFT_BUILD_NAMESPACE}/stable:node-maintenance-operator|g" {} \; || :

# Build index database
RUN /bin/initializer -m /tmp/manifests -o ./index.db
