From db3f57dabbe012351ee33480176f179224925878 Mon Sep 17 00:00:00 2001 From: Mohammed Rafeeq <49855183+m-rafeeq@users.noreply.github.com> Date: Wed, 31 Dec 2025 22:17:02 +0530 Subject: [PATCH] updating missing files for rhoai-3.3 --- Dockerfile.konflux | 75 ++++++++++++++++++++++++++++++++++++++++++ artifacts.lock.yaml | 7 ++++ requirements-torch.in | 2 ++ requirements-torch.txt | 29 ++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 Dockerfile.konflux create mode 100644 artifacts.lock.yaml create mode 100644 requirements-torch.in create mode 100644 requirements-torch.txt diff --git a/Dockerfile.konflux b/Dockerfile.konflux new file mode 100644 index 000000000..36aaa09e2 --- /dev/null +++ b/Dockerfile.konflux @@ -0,0 +1,75 @@ +FROM registry.access.redhat.com/ubi9/python-312:latest as build + +USER 0 +WORKDIR /app + +ARG GUARDRAILS_PROFILE=opensource + +COPY requirements.txt requirements-torch.txt pyproject.toml README.md ./ +COPY nemoguardrails/ ./nemoguardrails/ +COPY scripts/ ./scripts/ +COPY examples/bots/ ./examples/bots/ + +RUN chmod +x ./scripts/entrypoint.sh + +RUN python3 -m pip install --no-cache-dir pyyaml + +RUN python3 ./scripts/filter_guardrails.py ./scripts/provider-list.yaml $GUARDRAILS_PROFILE + +ENV HF_HOME=/app/.cache/huggingface \ + TRANSFORMERS_CACHE=/app/.cache/transformers \ + SENTENCE_TRANSFORMERS_HOME=/app/.cache/sentence_transformers \ + NLTK_DATA=/app/.cache/nltk_data \ + FASTEMBED_CACHE_PATH=/app/.cache/fastembed + +RUN python3 -m venv /app/.venv && \ + /app/.venv/bin/pip install --no-cache-dir -r requirements.txt && \ + /app/.venv/bin/pip install --no-cache-dir --no-deps . && \ + rm -rf /root/.cache/pip /tmp/* /var/tmp/* + +RUN /app/.venv/bin/pip install --no-cache-dir /cachi2/output/deps/generic/en_core_web_lg-3.8.0-py3-none-any.whl + +RUN /app/.venv/bin/pip install --no-cache-dir -r requirements-torch.txt + +RUN set -ex && \ + GUARDRAILS_PROFILE=$GUARDRAILS_PROFILE /app/.venv/bin/python ./scripts/pre_download_required_models.py && \ + find /app/.cache -type f -name "*.pyc" -delete && \ + find /app/.cache -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true && \ + find /app/.cache -type d -name ".git" -exec rm -rf {} + 2>/dev/null || true && \ + rm -rf /app/.cache/huggingface/xet /root/.cache /tmp/* /var/tmp/* + +FROM registry.access.redhat.com/ubi9/python-312:latest as runtime + +USER 0 +WORKDIR /app + +COPY --from=build /app /app + +RUN rm -f /etc/security/namespace.conf /usr/lib64/security/pam_namespace.so || true && \ + chgrp -R 0 /app && \ + chmod -R g=u /app && \ + chmod +x /app/scripts/entrypoint.sh + +USER 1001 + +ENV HF_HOME=/app/.cache/huggingface \ + TRANSFORMERS_CACHE=/app/.cache/transformers \ + SENTENCE_TRANSFORMERS_HOME=/app/.cache/sentence_transformers \ + NLTK_DATA=/app/.cache/nltk_data \ + FASTEMBED_CACHE_PATH=/app/.cache/fastembed \ + PATH="/app/.venv/bin:$PATH" \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +EXPOSE 8000 +ENTRYPOINT ["./scripts/entrypoint.sh"] + +LABEL com.redhat.component="odh-nemo-guardrails" \ + name="rhoai/odh-nemo-guardrails-rhel9" \ + description="NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems" \ + summary="odh-nemo-guardrails" \ + maintainer="['managed-open-data-hub@redhat.com']" \ + io.openshift.expose-services="8000:http" \ + io.k8s.display-name="odh-nemo-guardrails" \ + io.k8s.description="NeMo Guardrails toolkit for controlling and securing LLM-based conversational systems" \ + com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf" diff --git a/artifacts.lock.yaml b/artifacts.lock.yaml new file mode 100644 index 000000000..e558172f4 --- /dev/null +++ b/artifacts.lock.yaml @@ -0,0 +1,7 @@ +--- +metadata: + version: "1.0" +artifacts: + - download_url: "https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.8.0/en_core_web_lg-3.8.0-py3-none-any.whl" + checksum: "sha256:293e9547a655b25499198ab15a525b05b9407a75f10255e405e8c3854329ab63" + filename: "en_core_web_lg-3.8.0-py3-none-any.whl" diff --git a/requirements-torch.in b/requirements-torch.in new file mode 100644 index 000000000..c7b88f390 --- /dev/null +++ b/requirements-torch.in @@ -0,0 +1,2 @@ +--index-url https://download.pytorch.org/whl/cpu +torch==2.9.0 diff --git a/requirements-torch.txt b/requirements-torch.txt new file mode 100644 index 000000000..a9f87b5fd --- /dev/null +++ b/requirements-torch.txt @@ -0,0 +1,29 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile requirements-torch.in +# +--index-url https://download.pytorch.org/whl/cpu + +filelock==3.20.0 + # via torch +fsspec==2025.12.0 + # via torch +jinja2==3.1.6 + # via torch +markupsafe==2.1.5 + # via jinja2 +mpmath==1.3.0 + # via sympy +networkx==3.6.1 + # via torch +sympy==1.14.0 + # via torch +torch==2.9.0+cpu + # via -r requirements-torch.in +typing-extensions==4.15.0 + # via torch + +# The following packages are considered to be unsafe in a requirements file: +# setuptools