From 4f6b645f5f897b5543ffb212ff5afab51e90a3dc Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Wed, 11 Feb 2026 13:54:18 +0530 Subject: [PATCH 01/10] Docker image for openwebui-pipelines --- .../Dockerfile | 68 ++++++ o/openwebui-pipelines/LICENSE | 201 ++++++++++++++++++ o/openwebui-pipelines/build_info.json | 17 ++ 3 files changed, 286 insertions(+) create mode 100644 o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile create mode 100644 o/openwebui-pipelines/LICENSE create mode 100644 o/openwebui-pipelines/build_info.json diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile new file mode 100644 index 0000000000..77fd24b029 --- /dev/null +++ b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile @@ -0,0 +1,68 @@ +# --- STAGE 1: Build environment --- +FROM registry.access.redhat.com/ubi9/python-311:latest AS builder + +LABEL name="openwebui-pipelines" maintainer="Vikash.Singh14@ibm.com" + +USER root +WORKDIR /app + +RUN dnf update -y && dnf install -y --nodocs \ + gcc gcc-c++ make pkg-config git wget unzip \ + && dnf clean all && rm -rf /var/cache/dnf/* + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +RUN python -m venv /opt/venv && \ + . /opt/venv/bin/activate && \ + pip install --upgrade pip setuptools wheel + +RUN git clone --depth 1 https://github.com/open-webui/pipelines.git /app && \ + rm -rf /app/.git && \ + find /app -name '*.pyc' -o -name '*.pyo' -o -name '__pycache__' -type f -delete + +COPY requirements.txt /app/requirements.txt + +RUN . /opt/venv/bin/activate && \ + pip install -r requirements.txt \ + --index-url https://pypi.org/simple \ + --extra-index-url https://wheels.developerfirst.ibm.com/ppc64le/linux \ + --prefer-binary --use-deprecated=legacy-resolver --no-cache-dir && \ + rm -rf /root/.cache/pip + +# Optional cleanup: remove build tools from builder too +RUN yum remove -y gcc gcc-c++ make pkg-config git \ + && yum autoremove -y \ + && yum clean all \ + && rm -rf /var/cache/yum + + +# --- STAGE 2: Runtime --- +FROM registry.access.redhat.com/ubi9/python-311:latest + +LABEL name="open-webui-pipelines" maintainer="Vikash.Singh14@ibm.com" + +USER root +WORKDIR /app + +# Copy only what we need from builder +COPY --from=builder --chown=1001:0 /opt/venv /opt/venv +COPY --from=builder --chown=1001:0 /app /app + +# Use venv +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +# Remove build tools that are not needed at runtime +RUN yum remove -y gcc gcc-c++ make pkg-config git \ + && yum autoremove -y \ + && yum clean all \ + && rm -rf /var/cache/yum + +# Fix permissions +RUN chmod -R g+rwX /app /opt/venv && \ + find /app -type d -exec chmod g+s {} + 2>/dev/null || true + +EXPOSE 9099 +USER 1001 +CMD ["sh", "-c", "/opt/venv/bin/python -m uvicorn main:app --host 0.0.0.0 --port 9099"] \ No newline at end of file diff --git a/o/openwebui-pipelines/LICENSE b/o/openwebui-pipelines/LICENSE new file mode 100644 index 0000000000..9c8f3ea087 --- /dev/null +++ b/o/openwebui-pipelines/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/o/openwebui-pipelines/build_info.json b/o/openwebui-pipelines/build_info.json new file mode 100644 index 0000000000..1241084340 --- /dev/null +++ b/o/openwebui-pipelines/build_info.json @@ -0,0 +1,17 @@ +{ + "maintainer": "vikashsingh14", + "package_name": "openwebui-pipelines", + "github_url": "https://github.com/open-webui/pipelines", + "version": "0.0.1", + "default_branch": "main", + "build_script": "", + "package_dir": "o/openwebui-pipelines", + "docker_cmd": "docker build -t ${package_name}:${PACKAGE_VERSION} ${dir}", + "validate_build_script": false, + "wheel_build": false, + "*": { + "dir": "pipelines-openwebui_python311_main", + "base_docker_image":"registry.access.redhat.com/ubi9/python-311:latest", + "base_docker_variant": "redhat" + } +} \ No newline at end of file From afc94a2c58e993987acb5df9ae9b2ef5814fb102 Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Wed, 18 Feb 2026 10:46:46 +0530 Subject: [PATCH 02/10] chore(docker): optimize Dockerfile and reduce image size --- .../Dockerfile | 164 ++++++++++++------ .../build.sh | 31 ++++ .../patches/crashtracker_ppc64le.patch | 18 ++ .../patches/ddttrace_4.3.0_ppc64le.patch | 28 +++ .../patches/requirements.patch | 37 ++++ o/openwebui-pipelines/build_info.json | 2 + 6 files changed, 229 insertions(+), 51 deletions(-) create mode 100644 o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh create mode 100644 o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/crashtracker_ppc64le.patch create mode 100644 o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/ddttrace_4.3.0_ppc64le.patch create mode 100644 o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/requirements.patch diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile index 77fd24b029..55915b3a93 100644 --- a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile +++ b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile @@ -1,68 +1,130 @@ -# --- STAGE 1: Build environment --- -FROM registry.access.redhat.com/ubi9/python-311:latest AS builder +# --- STAGE 1: ddtrace Native Builder --- +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS ddtrace-native-builder -LABEL name="openwebui-pipelines" maintainer="Vikash.Singh14@ibm.com" +LABEL name="open-webui-pipelines" maintainer="Vikash.Singh14@ibm.com" USER root -WORKDIR /app - -RUN dnf update -y && dnf install -y --nodocs \ - gcc gcc-c++ make pkg-config git wget unzip \ - && dnf clean all && rm -rf /var/cache/dnf/* -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" +ENV PATH="/root/.cargo/bin:${PATH}" \ + CC=clang \ + PIP_NO_CACHE_DIR=1 + +RUN microdnf update -y && \ + microdnf install -y \ + --enablerepo=ubi-9-baseos-rpms --enablerepo=ubi-9-appstream-rpms \ + python3.11 python3.11-pip python3.11-devel \ + python3-setuptools python3.11-wheel \ + gcc gcc-c++ make git pkg-config \ + libffi-devel openssl-devel \ + clang clang-libs llvm llvm-devel \ + cmake findutils && \ + microdnf clean all && rm -rf /var/cache/* && \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ + python3.11 -m pip install --no-cache-dir \ + "cmake>=3.24.2,<3.28" cython setuptools-rust "setuptools_scm[toml]>=4" \ + patchelf semantic_version build -RUN python -m venv /opt/venv && \ - . /opt/venv/bin/activate && \ - pip install --upgrade pip setuptools wheel +WORKDIR /app +COPY patches /patches + +RUN python3.11 -m pip install --no-cache-dir \ + "cmake>=3.24.2,<3.28" cython setuptools-rust "setuptools_scm[toml]>=4" \ + patchelf semantic_version build && \ + git clone --depth=1 --branch v25.0.0 https://github.com/DataDog/libdatadog.git /tmp/libdatadog && \ + cd /tmp/libdatadog && \ + git apply /patches/crashtracker_ppc64le.patch && \ + cargo update -p libc --precise 0.2.178 && \ + cargo rustc --lib --release --crate-type staticlib -p libdd-crashtracker && \ + cd /tmp && \ + git clone --depth=1 --branch v4.3.0 https://github.com/DataDog/dd-trace-py.git /tmp/ddtrace && \ + cd /tmp/ddtrace && \ + git apply /patches/ddttrace_4.3.0_ppc64le.patch && \ + cp /tmp/libdatadog/target/release/liblibdd_crashtracker.a src/native/ && \ + cd src/native && \ + cargo build --release --features "pyo3/extension-module profiling" && \ + cd ../.. && \ + mkdir -p /artifacts/ddtrace && \ + mkdir -p /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native && \ + cp /tmp/ddtrace/src/native/target/release/lib_native.so \ + /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native/_native.cpython-311-powerpc64le-linux-gnu.so && \ + cd /tmp/ddtrace && \ + DD_USE_SYSTEM_LIBDATADOG=1 DD_NO_CRASHTRACKER=1 \ + python3.11 setup.py bdist_wheel --dist-dir=/artifacts/ddtrace && \ + rm -rf /tmp/* /root/.cargo /root/.rustup + +# --- STAGE 2: Pipelines Python Builder --- +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS pipelines-python-builder -RUN git clone --depth 1 https://github.com/open-webui/pipelines.git /app && \ - rm -rf /app/.git && \ - find /app -name '*.pyc' -o -name '*.pyo' -o -name '__pycache__' -type f -delete +USER root -COPY requirements.txt /app/requirements.txt +ENV PIP_NO_CACHE_DIR=1 \ + PIP_DISABLE_PIP_VERSION_CHECK=1 \ + PIP_NO_BUILD_ISOLATION=1 -RUN . /opt/venv/bin/activate && \ - pip install -r requirements.txt \ +WORKDIR /app +COPY patches/requirements.patch /patches/requirements.patch + +RUN microdnf update -y && \ + microdnf install -y \ + python3.11 python3.11-pip python3.11-devel python3.11-wheel \ + gcc gcc-c++ make git pkg-config \ + libffi-devel openssl-devel \ + cmake findutils patch && \ + microdnf clean all && rm -rf /var/cache/* && \ + python3.11 -m venv /opt/venv && \ + /opt/venv/bin/pip install --no-cache-dir --upgrade pip + +COPY --from=ddtrace-native-builder /artifacts/ddtrace/*.whl /tmp/ +COPY --from=ddtrace-native-builder \ + /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native/_native.cpython-311-powerpc64le-linux-gnu.so \ + /opt/venv/lib/python3.11/site-packages/ddtrace/internal/native/ + +RUN mkdir -p /opt/venv/lib/python3.11/site-packages/ddtrace/internal/native && \ + /opt/venv/bin/pip install /tmp/ddtrace-*.whl && \ + rm -rf /tmp/* && \ + git clone --depth=1 https://github.com/open-webui/pipelines.git . && \ + patch -p1 < /patches/requirements.patch && \ + /opt/venv/bin/pip install \ + --no-cache-dir --prefer-binary --only-binary=all \ --index-url https://pypi.org/simple \ --extra-index-url https://wheels.developerfirst.ibm.com/ppc64le/linux \ - --prefer-binary --use-deprecated=legacy-resolver --no-cache-dir && \ - rm -rf /root/.cache/pip + "grpcio==1.71.0" \ + "opencv-python==4.10.0.84" \ + -r requirements.txt && \ + rm -rf ~/.cache .git -# Optional cleanup: remove build tools from builder too -RUN yum remove -y gcc gcc-c++ make pkg-config git \ - && yum autoremove -y \ - && yum clean all \ - && rm -rf /var/cache/yum +ENV PATH="/opt/venv/bin:${PATH}" +RUN find /opt/venv -name '__pycache__' -type d -prune -exec rm -rf {} + && \ + find /opt/venv -type f -name '*.a' -delete && \ + find /opt/venv -type d -name 'doc' -o -name 'docs' -o -name 'tests' -o -name '*.egg-info' | xargs rm -rf 2>/dev/null || true -# --- STAGE 2: Runtime --- -FROM registry.access.redhat.com/ubi9/python-311:latest - -LABEL name="open-webui-pipelines" maintainer="Vikash.Singh14@ibm.com" +# --- STAGE 3: Runtime --- +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS pipelines-runtime USER root WORKDIR /app -# Copy only what we need from builder -COPY --from=builder --chown=1001:0 /opt/venv /opt/venv -COPY --from=builder --chown=1001:0 /app /app - -# Use venv -ENV VIRTUAL_ENV=/opt/venv -ENV PATH="/opt/venv/bin:$PATH" - -# Remove build tools that are not needed at runtime -RUN yum remove -y gcc gcc-c++ make pkg-config git \ - && yum autoremove -y \ - && yum clean all \ - && rm -rf /var/cache/yum - -# Fix permissions -RUN chmod -R g+rwX /app /opt/venv && \ - find /app -type d -exec chmod g+s {} + 2>/dev/null || true - -EXPOSE 9099 -USER 1001 -CMD ["sh", "-c", "/opt/venv/bin/python -m uvicorn main:app --host 0.0.0.0 --port 9099"] \ No newline at end of file +ENV ENV=prod \ + PORT=9099 \ + HOST=0.0.0.0 \ + DD_AGENT_HOST=host.dockerinternal \ + DD_TRACE_AGENT_PORT=8126 \ + DD_PROFILING_ENABLED=true \ + PYTHONPATH=/app \ + PATH="/opt/venv/bin:${PATH}" + +RUN microdnf update -y && \ + microdnf install -y python3.11 bash findutils && \ + microdnf clean all && rm -rf /var/cache/* + +COPY --from=pipelines-python-builder /app /app +COPY --from=pipelines-python-builder /opt/venv /opt/venv + +RUN mkdir -p /.cache /.local && \ + chgrp -R 0 /app /.cache /.local /opt/venv 2>/dev/null || true && \ + chmod -R g+rwX /app /.cache /.local /opt/venv 2>/dev/null || true && \ + find /app /opt/venv -type d -exec chmod g+s {} + 2>/dev/null || true + +EXPOSE ${PORT} +ENTRYPOINT ["bash", "start.sh"] \ No newline at end of file diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh new file mode 100644 index 0000000000..dc54cc9fe5 --- /dev/null +++ b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh @@ -0,0 +1,31 @@ +[root@ai-infusion-vikash-singh dockerfile-pipelines]# cat build.sh +#!/usr/bin/env bash +set -euo pipefail + +IMAGE_NAME="${IMAGE_NAME:-openwebui-pipelines}" +TAG="${TAG:-latest}" +PLATFORM="${PLATFORM:-linux/ppc64le}" +NO_CACHE="${NO_CACHE:-false}" + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +echo -e "${BLUE} Building ${IMAGE_NAME}:${TAG} (${PLATFORM})${NC}" + +podman build \ + ${NO_CACHE:+--no-cache} \ + --platform "${PLATFORM}" \ + --build-arg MINIMUM_BUILD=false \ + --build-arg USE_CUDA=false \ + --build-arg USE_CUDA_VER=cpu \ + --build-arg LIBDATADOG_VERSION=v25.0.0 \ + --build-arg DDTRACE_VERSION=v4.3.0 \ + -t "${IMAGE_NAME}:${TAG}" \ + -t "${IMAGE_NAME}:latest" \ + . + +SIZE=$(podman image inspect "${IMAGE_NAME}:${TAG}" --format='{{.Size}}' 2>/dev/null | awk '{printf "%.2fGB", $1/1024/1024/1024}') +echo -e "${GREEN} Complete: ${IMAGE_NAME}:${TAG} (${SIZE})${NC}" \ No newline at end of file diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/crashtracker_ppc64le.patch b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/crashtracker_ppc64le.patch new file mode 100644 index 0000000000..c879ba03c9 --- /dev/null +++ b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/crashtracker_ppc64le.patch @@ -0,0 +1,18 @@ +diff --git a/libdd-crashtracker/src/collector/emitters.rs b/libdd-crashtracker/src/collector/emitters.rs +index f609c9f9..cbbdd56a 100644 +--- a/libdd-crashtracker/src/collector/emitters.rs ++++ b/libdd-crashtracker/src/collector/emitters.rs +@@ -384,6 +384,13 @@ fn extract_ip(ucontext: *const ucontext_t) -> usize { + return (*ucontext).uc_mcontext.gregs[libc::REG_RIP as usize] as usize; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + return (*ucontext).uc_mcontext.pc as usize; ++ ++ #[cfg(all(target_os = "linux", any(target_arch = "powerpc64", target_arch = "powerpc64le")))] ++ return unsafe { ++ let regs = (*ucontext).uc_mcontext.regs as *const u64; ++ *regs.add(32) ++ } as usize; ++ + } + } + diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/ddttrace_4.3.0_ppc64le.patch b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/ddttrace_4.3.0_ppc64le.patch new file mode 100644 index 0000000000..c8fe8326b0 --- /dev/null +++ b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/ddttrace_4.3.0_ppc64le.patch @@ -0,0 +1,28 @@ +diff --git a/setup.py b/setup.py +index bf40f1f988..e5acabeaaf 100644 +--- a/setup.py ++++ b/setup.py +@@ -268,9 +268,11 @@ def is_64_bit_python(): + + rust_features = [] + if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): +- rust_features.append("crashtracker") ++ rust_features.append("pyo3/extension-module") + rust_features.append("profiling") + ++ if platform.machine() not in ("ppc64le", "ppc64"): ++ rust_features.append("crashtracker") + + class PatchedDistribution(Distribution): + def __init__(self, attrs=None): +@@ -616,8 +618,8 @@ class CustomBuildExt(build_ext): + def run(self): + self.build_rust() + +- # Build libdd_wrapper before building other extensions that depend on it +- if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): ++ # Build libdd_wrapper only when profiling is enabled ++ if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python() and "profiling" in rust_features: + self.build_libdd_wrapper() + + super().run() diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/requirements.patch b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/requirements.patch new file mode 100644 index 0000000000..65c8beec42 --- /dev/null +++ b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/requirements.patch @@ -0,0 +1,37 @@ +diff --git a/requirements.txt b/requirements.txt +index b3cc96e..202ad0d 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,6 +1,5 @@ + fastapi==0.111.0 + uvicorn[standard]==0.22.0 +-pydantic==2.7.1 + python-multipart==0.0.9 + python-socketio + grpcio +@@ -17,7 +16,6 @@ httpx + openai + anthropic + google-generativeai +-vertexai + + # Database + pymongo +@@ -31,7 +29,6 @@ psycopg2-binary + + # Observability + langfuse +-ddtrace + opik + + # ML libraries +@@ -58,10 +55,7 @@ matplotlib + seaborn + + # Web scraping +-selenium +-playwright +-beautifulsoup4 + + # Llama Index for RAG + llama-index diff --git a/o/openwebui-pipelines/build_info.json b/o/openwebui-pipelines/build_info.json index 1241084340..82c92256eb 100644 --- a/o/openwebui-pipelines/build_info.json +++ b/o/openwebui-pipelines/build_info.json @@ -9,6 +9,8 @@ "docker_cmd": "docker build -t ${package_name}:${PACKAGE_VERSION} ${dir}", "validate_build_script": false, "wheel_build": false, + "docker_build": true, + "use_non_root_user": false, "*": { "dir": "pipelines-openwebui_python311_main", "base_docker_image":"registry.access.redhat.com/ubi9/python-311:latest", From 3b07dabad7399fdd85e4f97af7ec1c5d2240bdec Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Wed, 18 Feb 2026 16:58:37 +0530 Subject: [PATCH 03/10] refactor: standardize Docker structure (ubi9-pipelines-v1.0.0) --- .../build.sh | 31 ------------------- .../Dockerfile | 0 .../patches/ddtrace_4.3.0.patch} | 0 .../libdatadog-crashtracker_25.0.0.patch} | 0 .../patches/pipelines_requirements.patch} | 0 5 files changed, 31 deletions(-) delete mode 100644 o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh rename o/openwebui-pipelines/{Dockerfiles/pipelines-openwebui_python311_main => ubi9-pipelines-v1.0.0}/Dockerfile (100%) rename o/openwebui-pipelines/{Dockerfiles/pipelines-openwebui_python311_main/patches/ddttrace_4.3.0_ppc64le.patch => ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch} (100%) rename o/openwebui-pipelines/{Dockerfiles/pipelines-openwebui_python311_main/patches/crashtracker_ppc64le.patch => ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch} (100%) rename o/openwebui-pipelines/{Dockerfiles/pipelines-openwebui_python311_main/patches/requirements.patch => ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch} (100%) diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh b/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh deleted file mode 100644 index dc54cc9fe5..0000000000 --- a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/build.sh +++ /dev/null @@ -1,31 +0,0 @@ -[root@ai-infusion-vikash-singh dockerfile-pipelines]# cat build.sh -#!/usr/bin/env bash -set -euo pipefail - -IMAGE_NAME="${IMAGE_NAME:-openwebui-pipelines}" -TAG="${TAG:-latest}" -PLATFORM="${PLATFORM:-linux/ppc64le}" -NO_CACHE="${NO_CACHE:-false}" - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -echo -e "${BLUE} Building ${IMAGE_NAME}:${TAG} (${PLATFORM})${NC}" - -podman build \ - ${NO_CACHE:+--no-cache} \ - --platform "${PLATFORM}" \ - --build-arg MINIMUM_BUILD=false \ - --build-arg USE_CUDA=false \ - --build-arg USE_CUDA_VER=cpu \ - --build-arg LIBDATADOG_VERSION=v25.0.0 \ - --build-arg DDTRACE_VERSION=v4.3.0 \ - -t "${IMAGE_NAME}:${TAG}" \ - -t "${IMAGE_NAME}:latest" \ - . - -SIZE=$(podman image inspect "${IMAGE_NAME}:${TAG}" --format='{{.Size}}' 2>/dev/null | awk '{printf "%.2fGB", $1/1024/1024/1024}') -echo -e "${GREEN} Complete: ${IMAGE_NAME}:${TAG} (${SIZE})${NC}" \ No newline at end of file diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile similarity index 100% rename from o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/Dockerfile rename to o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/ddttrace_4.3.0_ppc64le.patch b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch similarity index 100% rename from o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/ddttrace_4.3.0_ppc64le.patch rename to o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/crashtracker_ppc64le.patch b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch similarity index 100% rename from o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/crashtracker_ppc64le.patch rename to o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch diff --git a/o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/requirements.patch b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch similarity index 100% rename from o/openwebui-pipelines/Dockerfiles/pipelines-openwebui_python311_main/patches/requirements.patch rename to o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch From 3b29f484ff315a06d646a2fec070fc537f947f8a Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Wed, 18 Feb 2026 18:42:37 +0530 Subject: [PATCH 04/10] feat(docker): use wget for patches downloads --- .../ubi9-pipelines-v1.0.0/Dockerfile | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile index 55915b3a93..3d5f006876 100644 --- a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile +++ b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile @@ -17,28 +17,32 @@ RUN microdnf update -y && \ gcc gcc-c++ make git pkg-config \ libffi-devel openssl-devel \ clang clang-libs llvm llvm-devel \ - cmake findutils && \ + cmake findutils wget && \ microdnf clean all && rm -rf /var/cache/* && \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ python3.11 -m pip install --no-cache-dir \ "cmake>=3.24.2,<3.28" cython setuptools-rust "setuptools_scm[toml]>=4" \ - patchelf semantic_version build + patchelf semantic_version build && \ + mkdir -p /patches && \ + wget -q -O /patches/libdatadog-crashtracker_25.0.0.patch \ + https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch && \ + wget -q -O /patches/ddtrace_4.3.0.patch \ + https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch WORKDIR /app -COPY patches /patches RUN python3.11 -m pip install --no-cache-dir \ "cmake>=3.24.2,<3.28" cython setuptools-rust "setuptools_scm[toml]>=4" \ patchelf semantic_version build && \ git clone --depth=1 --branch v25.0.0 https://github.com/DataDog/libdatadog.git /tmp/libdatadog && \ cd /tmp/libdatadog && \ - git apply /patches/crashtracker_ppc64le.patch && \ + git apply /patches/libdatadog-crashtracker_25.0.0.patch && \ cargo update -p libc --precise 0.2.178 && \ cargo rustc --lib --release --crate-type staticlib -p libdd-crashtracker && \ cd /tmp && \ git clone --depth=1 --branch v4.3.0 https://github.com/DataDog/dd-trace-py.git /tmp/ddtrace && \ cd /tmp/ddtrace && \ - git apply /patches/ddttrace_4.3.0_ppc64le.patch && \ + git apply /patches/ddtrace_4.3.0.patch && \ cp /tmp/libdatadog/target/release/liblibdd_crashtracker.a src/native/ && \ cd src/native && \ cargo build --release --features "pyo3/extension-module profiling" && \ @@ -62,17 +66,19 @@ ENV PIP_NO_CACHE_DIR=1 \ PIP_NO_BUILD_ISOLATION=1 WORKDIR /app -COPY patches/requirements.patch /patches/requirements.patch RUN microdnf update -y && \ microdnf install -y \ python3.11 python3.11-pip python3.11-devel python3.11-wheel \ gcc gcc-c++ make git pkg-config \ libffi-devel openssl-devel \ - cmake findutils patch && \ + cmake findutils wget && \ microdnf clean all && rm -rf /var/cache/* && \ python3.11 -m venv /opt/venv && \ - /opt/venv/bin/pip install --no-cache-dir --upgrade pip + /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ + mkdir -p /patches && \ + wget -q -O /patches/pipelines_requirements.patch \ + https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch COPY --from=ddtrace-native-builder /artifacts/ddtrace/*.whl /tmp/ COPY --from=ddtrace-native-builder \ @@ -83,7 +89,7 @@ RUN mkdir -p /opt/venv/lib/python3.11/site-packages/ddtrace/internal/native && \ /opt/venv/bin/pip install /tmp/ddtrace-*.whl && \ rm -rf /tmp/* && \ git clone --depth=1 https://github.com/open-webui/pipelines.git . && \ - patch -p1 < /patches/requirements.patch && \ + git apply /patches/pipelines_requirements.patch && \ /opt/venv/bin/pip install \ --no-cache-dir --prefer-binary --only-binary=all \ --index-url https://pypi.org/simple \ From 96065e436f5c6844fe49f140cefb8d7928b0077e Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Thu, 19 Feb 2026 09:22:36 +0530 Subject: [PATCH 05/10] fix(docker): correct requirements.patch file added --- .../ubi9-pipelines-v1.0.0/Dockerfile | 6 +++--- ...ines_requirements.patch => requirements.patch} | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) rename o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/{pipelines_requirements.patch => requirements.patch} (58%) diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile index 3d5f006876..3e549878ca 100644 --- a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile +++ b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile @@ -77,8 +77,8 @@ RUN microdnf update -y && \ python3.11 -m venv /opt/venv && \ /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ mkdir -p /patches && \ - wget -q -O /patches/pipelines_requirements.patch \ - https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch + wget -q -O /patches/requirements.patch \ + https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch COPY --from=ddtrace-native-builder /artifacts/ddtrace/*.whl /tmp/ COPY --from=ddtrace-native-builder \ @@ -89,7 +89,7 @@ RUN mkdir -p /opt/venv/lib/python3.11/site-packages/ddtrace/internal/native && \ /opt/venv/bin/pip install /tmp/ddtrace-*.whl && \ rm -rf /tmp/* && \ git clone --depth=1 https://github.com/open-webui/pipelines.git . && \ - git apply /patches/pipelines_requirements.patch && \ + git apply /patches/requirements.patch && \ /opt/venv/bin/pip install \ --no-cache-dir --prefer-binary --only-binary=all \ --index-url https://pypi.org/simple \ diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch similarity index 58% rename from o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch rename to o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch index 65c8beec42..7d2e64e202 100644 --- a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/pipelines_requirements.patch +++ b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch @@ -1,7 +1,5 @@ -diff --git a/requirements.txt b/requirements.txt -index b3cc96e..202ad0d 100644 ---- a/requirements.txt -+++ b/requirements.txt +--- ../patches/requirements.orig 2026-02-17 07:16:01.471242478 -0500 ++++ requirements.txt 2026-02-17 07:16:01.481242477 -0500 @@ -1,6 +1,5 @@ fastapi==0.111.0 uvicorn[standard]==0.22.0 @@ -9,7 +7,7 @@ index b3cc96e..202ad0d 100644 python-multipart==0.0.9 python-socketio grpcio -@@ -17,7 +16,6 @@ httpx +@@ -17,7 +16,6 @@ openai anthropic google-generativeai @@ -17,7 +15,7 @@ index b3cc96e..202ad0d 100644 # Database pymongo -@@ -31,7 +29,6 @@ psycopg2-binary +@@ -31,7 +29,6 @@ # Observability langfuse @@ -25,7 +23,7 @@ index b3cc96e..202ad0d 100644 opik # ML libraries -@@ -58,10 +55,7 @@ matplotlib +@@ -58,10 +55,7 @@ seaborn # Web scraping @@ -35,3 +33,6 @@ index b3cc96e..202ad0d 100644 # Llama Index for RAG llama-index +-llama-index-llms-ollama +\ No newline at end of file ++llama-index-llms-ollama From 59272eb39035238103e4f00dbe988ad8d54cf8e2 Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Thu, 19 Feb 2026 10:01:07 +0530 Subject: [PATCH 06/10] fix(docker): updated base image --- o/openwebui-pipelines/build_info.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/o/openwebui-pipelines/build_info.json b/o/openwebui-pipelines/build_info.json index 82c92256eb..0a43731b56 100644 --- a/o/openwebui-pipelines/build_info.json +++ b/o/openwebui-pipelines/build_info.json @@ -12,8 +12,8 @@ "docker_build": true, "use_non_root_user": false, "*": { - "dir": "pipelines-openwebui_python311_main", - "base_docker_image":"registry.access.redhat.com/ubi9/python-311:latest", + "dir": "ubi9-pipelines-v1.0.0", + "base_docker_image":"registry.access.redhat.com/ubi9/ubi-minimal:latest", "base_docker_variant": "redhat" } } \ No newline at end of file From 18c0a03333ad124f73c5a63f2b85d6fa013de107 Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Fri, 20 Feb 2026 15:24:39 +0530 Subject: [PATCH 07/10] fix(dockerfile): use ppc64le/build-scripts/master patch URLs --- .../ubi9-pipelines-v1.0.0/Dockerfile | 123 ++++++++++++------ 1 file changed, 82 insertions(+), 41 deletions(-) diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile index 3e549878ca..46134f5072 100644 --- a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile +++ b/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile @@ -9,48 +9,60 @@ ENV PATH="/root/.cargo/bin:${PATH}" \ CC=clang \ PIP_NO_CACHE_DIR=1 -RUN microdnf update -y && \ +RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ + microdnf update -y && \ microdnf install -y \ - --enablerepo=ubi-9-baseos-rpms --enablerepo=ubi-9-appstream-rpms \ - python3.11 python3.11-pip python3.11-devel \ - python3-setuptools python3.11-wheel \ - gcc gcc-c++ make git pkg-config \ - libffi-devel openssl-devel \ - clang clang-libs llvm llvm-devel \ - cmake findutils wget && \ + --enablerepo=ubi-9-baseos-rpms \ + --enablerepo=ubi-9-appstream-rpms \ + python3.11 \ + python3.11-pip \ + python3.11-devel \ + python3-setuptools \ + python3.11-wheel \ + gcc gcc-c++ make git pkg-config \ + libffi-devel openssl-devel \ + clang clang-libs llvm llvm-devel \ + cmake \ + findutils \ + wget \ + ca-certificates && \ microdnf clean all && rm -rf /var/cache/* && \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ python3.11 -m pip install --no-cache-dir \ - "cmake>=3.24.2,<3.28" cython setuptools-rust "setuptools_scm[toml]>=4" \ - patchelf semantic_version build && \ + cmake \ + cython \ + setuptools-rust \ + "setuptools_scm[toml]>=4" \ + patchelf \ + semantic_version \ + build && \ mkdir -p /patches && \ wget -q -O /patches/libdatadog-crashtracker_25.0.0.patch \ - https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch && \ + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch && \ wget -q -O /patches/ddtrace_4.3.0.patch \ - https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch WORKDIR /app -RUN python3.11 -m pip install --no-cache-dir \ - "cmake>=3.24.2,<3.28" cython setuptools-rust "setuptools_scm[toml]>=4" \ - patchelf semantic_version build && \ - git clone --depth=1 --branch v25.0.0 https://github.com/DataDog/libdatadog.git /tmp/libdatadog && \ +# --- Build libdatadog and ddtrace --- +RUN git clone --depth=1 --branch v25.0.0 https://github.com/DataDog/libdatadog.git /tmp/libdatadog && \ cd /tmp/libdatadog && \ git apply /patches/libdatadog-crashtracker_25.0.0.patch && \ cargo update -p libc --precise 0.2.178 && \ cargo rustc --lib --release --crate-type staticlib -p libdd-crashtracker && \ - cd /tmp && \ + \ git clone --depth=1 --branch v4.3.0 https://github.com/DataDog/dd-trace-py.git /tmp/ddtrace && \ cd /tmp/ddtrace && \ git apply /patches/ddtrace_4.3.0.patch && \ cp /tmp/libdatadog/target/release/liblibdd_crashtracker.a src/native/ && \ cd src/native && \ cargo build --release --features "pyo3/extension-module profiling" && \ - cd ../.. && \ + \ mkdir -p /artifacts/ddtrace && \ mkdir -p /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native && \ - cp /tmp/ddtrace/src/native/target/release/lib_native.so \ + cp target/release/lib_native.so \ /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native/_native.cpython-311-powerpc64le-linux-gnu.so && \ + \ cd /tmp/ddtrace && \ DD_USE_SYSTEM_LIBDATADOG=1 DD_NO_CRASHTRACKER=1 \ python3.11 setup.py bdist_wheel --dist-dir=/artifacts/ddtrace && \ @@ -63,47 +75,61 @@ USER root ENV PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ - PIP_NO_BUILD_ISOLATION=1 + PIP_NO_BUILD_ISOLATION=1 \ + PATH="/opt/venv/bin:${PATH}" WORKDIR /app -RUN microdnf update -y && \ +RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ + microdnf update -y --nobest && \ microdnf install -y \ - python3.11 python3.11-pip python3.11-devel python3.11-wheel \ - gcc gcc-c++ make git pkg-config \ - libffi-devel openssl-devel \ - cmake findutils wget && \ + --enablerepo=ubi-9-baseos-rpms \ + --enablerepo=ubi-9-appstream-rpms \ + python3.11 \ + python3.11-pip \ + python3.11-devel \ + python3.11-wheel \ + python3-setuptools \ + gcc gcc-c++ make git pkg-config \ + libffi-devel \ + openssl-devel \ + ca-certificates \ + cmake \ + findutils \ + wget \ + curl-minimal && \ microdnf clean all && rm -rf /var/cache/* && \ python3.11 -m venv /opt/venv && \ /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ mkdir -p /patches && \ wget -q -O /patches/requirements.patch \ - https://raw.githubusercontent.com/vikashsingh14/build-scripts/openwebui-pipelines-dockerfile/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch COPY --from=ddtrace-native-builder /artifacts/ddtrace/*.whl /tmp/ COPY --from=ddtrace-native-builder \ /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native/_native.cpython-311-powerpc64le-linux-gnu.so \ /opt/venv/lib/python3.11/site-packages/ddtrace/internal/native/ -RUN mkdir -p /opt/venv/lib/python3.11/site-packages/ddtrace/internal/native && \ - /opt/venv/bin/pip install /tmp/ddtrace-*.whl && \ +RUN /opt/venv/bin/pip install /tmp/ddtrace-*.whl && \ rm -rf /tmp/* && \ git clone --depth=1 https://github.com/open-webui/pipelines.git . && \ git apply /patches/requirements.patch && \ /opt/venv/bin/pip install \ - --no-cache-dir --prefer-binary --only-binary=all \ - --index-url https://pypi.org/simple \ - --extra-index-url https://wheels.developerfirst.ibm.com/ppc64le/linux \ - "grpcio==1.71.0" \ - "opencv-python==4.10.0.84" \ - -r requirements.txt && \ + --no-cache-dir \ + --prefer-binary \ + --only-binary=all \ + --index-url https://pypi.org/simple \ + --extra-index-url https://wheels.developerfirst.ibm.com/ppc64le/linux \ + "grpcio==1.71.0" \ + "opencv-python==4.10.0.84" \ + -r requirements.txt && \ rm -rf ~/.cache .git -ENV PATH="/opt/venv/bin:${PATH}" - +# Cleanup like Milvus RUN find /opt/venv -name '__pycache__' -type d -prune -exec rm -rf {} + && \ find /opt/venv -type f -name '*.a' -delete && \ - find /opt/venv -type d -name 'doc' -o -name 'docs' -o -name 'tests' -o -name '*.egg-info' | xargs rm -rf 2>/dev/null || true + find /opt/venv -type d \( -name 'doc' -o -name 'docs' -o -name 'tests' -o -name '*.egg-info' \) \ + -exec rm -rf {} + 2>/dev/null || true # --- STAGE 3: Runtime --- FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS pipelines-runtime @@ -118,10 +144,25 @@ ENV ENV=prod \ DD_TRACE_AGENT_PORT=8126 \ DD_PROFILING_ENABLED=true \ PYTHONPATH=/app \ - PATH="/opt/venv/bin:${PATH}" + PATH="/opt/venv/bin:${PATH}" \ + LD_LIBRARY_PATH="/opt/venv/lib:/usr/lib" -RUN microdnf update -y && \ - microdnf install -y python3.11 bash findutils && \ +RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ + microdnf update -y && \ + microdnf install -y \ + bash \ + gcc \ + gcc-c++ \ + make \ + cmake \ + pkg-config \ + libffi \ + openssl \ + protobuf \ + findutils \ + python3.11 \ + python3.11-pip \ + ca-certificates && \ microdnf clean all && rm -rf /var/cache/* COPY --from=pipelines-python-builder /app /app @@ -133,4 +174,4 @@ RUN mkdir -p /.cache /.local && \ find /app /opt/venv -type d -exec chmod g+s {} + 2>/dev/null || true EXPOSE ${PORT} -ENTRYPOINT ["bash", "start.sh"] \ No newline at end of file +ENTRYPOINT ["bash", "start.sh"] From 3ff70678c15281ea5c84f8c681851637f2ed780c Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Fri, 20 Feb 2026 16:20:19 +0530 Subject: [PATCH 08/10] fix(folder-structure): align folder layout with versioned build structure --- o/openwebui-pipelines/build_info.json | 2 +- .../0.0.1_ubi9_minimal}/Dockerfile | 15 ++++++++------- .../patches/ddtrace_4.3.0.patch | 0 .../patches/libdatadog-crashtracker_25.0.0.patch | 0 .../patches/requirements.patch | 0 5 files changed, 9 insertions(+), 8 deletions(-) rename o/openwebui-pipelines/{ubi9-pipelines-v1.0.0 => dockerfiles/0.0.1_ubi9_minimal}/Dockerfile (93%) rename o/openwebui-pipelines/{ubi9-pipelines-v1.0.0 => }/patches/ddtrace_4.3.0.patch (100%) rename o/openwebui-pipelines/{ubi9-pipelines-v1.0.0 => }/patches/libdatadog-crashtracker_25.0.0.patch (100%) rename o/openwebui-pipelines/{ubi9-pipelines-v1.0.0 => }/patches/requirements.patch (100%) diff --git a/o/openwebui-pipelines/build_info.json b/o/openwebui-pipelines/build_info.json index 0a43731b56..a2abdf9d8e 100644 --- a/o/openwebui-pipelines/build_info.json +++ b/o/openwebui-pipelines/build_info.json @@ -12,7 +12,7 @@ "docker_build": true, "use_non_root_user": false, "*": { - "dir": "ubi9-pipelines-v1.0.0", + "dir": "0.0.1_ubi9_minimal", "base_docker_image":"registry.access.redhat.com/ubi9/ubi-minimal:latest", "base_docker_variant": "redhat" } diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile b/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile similarity index 93% rename from o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile rename to o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile index 46134f5072..c00281ec21 100644 --- a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/Dockerfile +++ b/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile @@ -38,9 +38,9 @@ RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ build && \ mkdir -p /patches && \ wget -q -O /patches/libdatadog-crashtracker_25.0.0.patch \ - https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch && \ + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/libdatadog-crashtracker_25.0.0.patch && \ wget -q -O /patches/ddtrace_4.3.0.patch \ - https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/ddtrace_4.3.0.patch WORKDIR /app @@ -103,7 +103,7 @@ RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ mkdir -p /patches && \ wget -q -O /patches/requirements.patch \ - https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/requirements.patch COPY --from=ddtrace-native-builder /artifacts/ddtrace/*.whl /tmp/ COPY --from=ddtrace-native-builder \ @@ -147,9 +147,10 @@ ENV ENV=prod \ PATH="/opt/venv/bin:${PATH}" \ LD_LIBRARY_PATH="/opt/venv/lib:/usr/lib" -RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ - microdnf update -y && \ - microdnf install -y \ +RUN mkdir -p /etc/yum.repos.d && \ + rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ + microdnf --disableplugin=subscription-manager update -y && \ + microdnf --disableplugin=subscription-manager install -y \ bash \ gcc \ gcc-c++ \ @@ -158,10 +159,10 @@ RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ pkg-config \ libffi \ openssl \ - protobuf \ findutils \ python3.11 \ python3.11-pip \ + python3.11-devel \ ca-certificates && \ microdnf clean all && rm -rf /var/cache/* diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch b/o/openwebui-pipelines/patches/ddtrace_4.3.0.patch similarity index 100% rename from o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/ddtrace_4.3.0.patch rename to o/openwebui-pipelines/patches/ddtrace_4.3.0.patch diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch b/o/openwebui-pipelines/patches/libdatadog-crashtracker_25.0.0.patch similarity index 100% rename from o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/libdatadog-crashtracker_25.0.0.patch rename to o/openwebui-pipelines/patches/libdatadog-crashtracker_25.0.0.patch diff --git a/o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch b/o/openwebui-pipelines/patches/requirements.patch similarity index 100% rename from o/openwebui-pipelines/ubi9-pipelines-v1.0.0/patches/requirements.patch rename to o/openwebui-pipelines/patches/requirements.patch From 2a6a1e75606cab7433cbda633accbd3b233a884c Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Fri, 20 Feb 2026 17:21:01 +0530 Subject: [PATCH 09/10] fix(patch-name): align patch name with package-name-version.patch --- .../dockerfiles/0.0.1_ubi9_minimal/Dockerfile | 4 ++-- ...nts.patch => openwebui-pipelines-requirements-0.0.1.patch} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename o/openwebui-pipelines/patches/{requirements.patch => openwebui-pipelines-requirements-0.0.1.patch} (100%) diff --git a/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile b/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile index c00281ec21..71cb1d02cd 100644 --- a/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile +++ b/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile @@ -102,8 +102,8 @@ RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ python3.11 -m venv /opt/venv && \ /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ mkdir -p /patches && \ - wget -q -O /patches/requirements.patch \ - https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/requirements.patch + wget -q -O /patches/openwebui-pipelines-requirements-0.0.1.patch \ + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/openwebui-pipelines-requirements-0.0.1.patch COPY --from=ddtrace-native-builder /artifacts/ddtrace/*.whl /tmp/ COPY --from=ddtrace-native-builder \ diff --git a/o/openwebui-pipelines/patches/requirements.patch b/o/openwebui-pipelines/patches/openwebui-pipelines-requirements-0.0.1.patch similarity index 100% rename from o/openwebui-pipelines/patches/requirements.patch rename to o/openwebui-pipelines/patches/openwebui-pipelines-requirements-0.0.1.patch From d65764889758d4d5aa1700083542d658886f763c Mon Sep 17 00:00:00 2001 From: Vikash Singh Date: Mon, 23 Feb 2026 22:20:38 +0530 Subject: [PATCH 10/10] build(ddtrace): add ddtrace_4.3.0_ubi_9_minimal.sh and build-info.json (with patches/) --- d/ddtrace/LICENSE | 201 ++++++++++++++++++ d/ddtrace/build_info.json | 22 ++ d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh | 157 ++++++++++++++ d/ddtrace/patches/ddtrace_4.3.0.patch | 28 +++ .../libdatadog-crashtracker_25.0.0.patch | 18 ++ 5 files changed, 426 insertions(+) create mode 100644 d/ddtrace/LICENSE create mode 100644 d/ddtrace/build_info.json create mode 100644 d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh create mode 100644 d/ddtrace/patches/ddtrace_4.3.0.patch create mode 100644 d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch diff --git a/d/ddtrace/LICENSE b/d/ddtrace/LICENSE new file mode 100644 index 0000000000..9c8f3ea087 --- /dev/null +++ b/d/ddtrace/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/d/ddtrace/build_info.json b/d/ddtrace/build_info.json new file mode 100644 index 0000000000..c37a945281 --- /dev/null +++ b/d/ddtrace/build_info.json @@ -0,0 +1,22 @@ +{ + "maintainer": "vikashsingh14", + "package_name": "ddtrace", + "github_url": "https://github.com/DataDog/dd-trace-py", + "version": "4.3.0", + "default_branch": "main", + + "build_script": "ddtrace_4.3.0_ubi_9_minimal.sh", + "package_dir": "d/ddtrace/", + "validate_build_script": true, + "use_non_root_user": false, + "docker_build": false, + "wheel_build": true, + + "4.3.*": { + "build_script": "ddtrace_4.3.0_ubi_9_minimal.sh", + "patches": { + "DDTRACE_PATCH": "https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/ddtrace_4.3.0.patch", + "LIBDATADOG_CRASHTRACKER_PATCH": "https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch" + } + } +} \ No newline at end of file diff --git a/d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh b/d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh new file mode 100644 index 0000000000..5b43e27e78 --- /dev/null +++ b/d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh @@ -0,0 +1,157 @@ +#!/bin/bash -e +# ---------------------------------------------------------------------------- +# +# Package : ddtrace +# Version : 4.3.0 +# Source repo : https://github.com/DataDog/dd-trace-py +# Tested on : UBI:9.3 +# Language : Python,Rust +# Ci-Check : True +# Script License : Apache License, Version 2 or later +# Maintainer : Vikash Kumar Singh +# +# Disclaimer: This script has been tested in root mode on given +# ========== platform using the mentioned version of the package. +# It may not work as expected with newer versions of the +# package and/or distribution. In such case, please +# contact "Maintainer" of this script. +# +# ---------------------------------------------------------------------------- + +PACKAGE_NAME=ddtrace +PACKAGE_URL=https://github.com/DataDog/dd-trace-py.git +PACKAGE_VERSION=${1:-v4.3.0} + +# libdatadog version to vendor crashtracker from +LIBDATADOG_VERSION=${LIBDATADOG_VERSION:-v25.0.0} + +# Patches hosted in build-scripts (Agent-style: fetch via wget then git apply) +DDTRACE_PATCH_URL=${DDTRACE_PATCH_URL:-https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/ddtrace_4.3.0.patch} +LIBDD_PATCH_URL=${LIBDD_PATCH_URL:-https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch} + +# Build toggles (keep crashtracker off at runtime for smoke test) +export DD_USE_SYSTEM_LIBDATADOG=${DD_USE_SYSTEM_LIBDATADOG:-1} +export DD_NO_CRASHTRACKER=${DD_NO_CRASHTRACKER:-1} + +# ---------------------------------------------------------------------------- +# Install required dependencies +# ---------------------------------------------------------------------------- +yum install -y wget git python3 python3-devel openssl openssl-devel make gcc gcc-c++ diffutils cmake patch rust cargo findutils libffi-devel elfutils-libelf-devel + +# Ensure pip/setuptools/wheel and build deps required by ddtrace build system +# NOTE: ddtrace build docs require cmake >=3.24.2,<3.28 for source builds. +python3 -m pip install --upgrade pip setuptools wheel +python3 -m pip install "cmake>=3.24.2,<3.28" cython "setuptools-rust<2" "setuptools_scm[toml]>=4" pytest twine || true + +# ---------------------------------------------------------------------------- +# Clone ddtrace and checkout version +# ---------------------------------------------------------------------------- +git clone "${PACKAGE_URL}" +cd "${PACKAGE_NAME}" +git checkout "${PACKAGE_VERSION}" + +# Apply ddtrace patch (if available) +wget -O ddtrace.patch "${DDTRACE_PATCH_URL}" || true +if [ -s ddtrace.patch ]; then + git apply --ignore-whitespace ddtrace.patch || true +fi + +# ---------------------------------------------------------------------------- +# Build libdatadog (crashtracker) and stage static archive into ddtrace +# ---------------------------------------------------------------------------- +TMPDIR="$(mktemp -d)" +pushd "${TMPDIR}" >/dev/null + git clone --depth=1 --branch "${LIBDATADOG_VERSION}" https://github.com/DataDog/libdatadog.git + cd libdatadog + + # Apply libdatadog crashtracker patch (if available) + wget -O libdd.patch "${LIBDD_PATCH_URL}" || true + if [ -s libdd.patch ]; then + git apply --ignore-whitespace libdd.patch || true + fi + + # Pin libc crate as per working flow + cargo update -p libc --precise 0.2.178 + + # Build crashtracker staticlib + cargo rustc --lib --release --crate-type staticlib -p libdd-crashtracker + + # Locate produced static archive (hashed or plain) + CRASH_A="$(find target -type f -name 'liblibdd_crashtracker*.a' | head -n1 || true)" + if [ -z "${CRASH_A}" ] || [ ! -f "${CRASH_A}" ]; then + echo "------------------$PACKAGE_NAME:build_fails-------------------------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Build_Fails (crashtracker .a not found)" + exit 1 + fi +popd >/dev/null + +# Stage the crashtracker archive into ddtrace src/native/ +mkdir -p src/native +cp -f "${TMPDIR}/${CRASH_A}" src/native/liblibdd_crashtracker.a + +# ---------------------------------------------------------------------------- +# Build ddtrace native extension (Rust) and make it visible to CMake +# ---------------------------------------------------------------------------- +pushd src/native >/dev/null + cargo build --release --features "pyo3/extension-module profiling" + + # Discover produced .so (support hashed filenames in target tree) + SRC_SO="$(find target ../target -type f \( -name 'libddtrace*_native*.so' -o -name 'lib_native*.so' \) 2>/dev/null | head -n1 || true)" + if [ -z "${SRC_SO}" ] || [ ! -f "${SRC_SO}" ]; then + SRC_SO="$(find "${CARGO_TARGET_DIR:-.}" -type f \( -name 'libddtrace*_native*.so' -o -name 'lib_native*.so' \) 2>/dev/null | head -n1 || true)" + fi +popd >/dev/null + +if [ -z "${SRC_SO}" ] || [ ! -f "${SRC_SO}" ]; then + echo "------------------$PACKAGE_NAME:build_fails-------------------------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Build_Fails (native .so not found)" + exit 1 +fi + +# Place .so where CMake's dd_wrapper expects it: build/lib./.../_native.*.so +PLAT="$(python3 - <<'PY' +from pkg_resources import get_build_platform +print(get_build_platform()) +PY +)" +SOABI="$(python3 - <<'PY' +import sysconfig, sys +print(sysconfig.get_config_var('SOABI') or f"cpython-{sys.version_info.major}{sys.version_info.minor}-{sys.platform}") +PY +)" +BUILD_LIB_DIR="build/lib.${PLAT}/ddtrace/internal/native" +mkdir -p "${BUILD_LIB_DIR}" +cp -f "${SRC_SO}" "${BUILD_LIB_DIR}/_native.${SOABI}.so" + +# ---------------------------------------------------------------------------- +# Build Wheel (Agent-style: setup.py bdist_wheel, no build isolation) +# ---------------------------------------------------------------------------- +if ! python3 setup.py bdist_wheel --dist-dir="$(pwd)"; then + echo "------------------$PACKAGE_NAME:build_fails-------------------------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Build_Fails" + exit 1 +fi + +# Optional checksum (not required but helpful) +sha256sum ddtrace-*.whl > SHA256SUMS 2>/dev/null || true + +# ---------------------------------------------------------------------------- +# Install wheel and run upstream smoke test (tests/smoke_test.py) via pytest +# ---------------------------------------------------------------------------- +python3 -m pip install --force-reinstall ./ddtrace-*.whl + +# Run only the upstream smoke test to validate install/runtime +if ! python3 -m pytest -q tests/smoke_test.py; then + echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Test_Fails" + exit 2 +fi + +echo "------------------$PACKAGE_NAME:install_and_test_success-------------------------" +echo "$PACKAGE_VERSION $PACKAGE_NAME" +echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Pass | Install_and_Test_Success" +exit 0 \ No newline at end of file diff --git a/d/ddtrace/patches/ddtrace_4.3.0.patch b/d/ddtrace/patches/ddtrace_4.3.0.patch new file mode 100644 index 0000000000..c8fe8326b0 --- /dev/null +++ b/d/ddtrace/patches/ddtrace_4.3.0.patch @@ -0,0 +1,28 @@ +diff --git a/setup.py b/setup.py +index bf40f1f988..e5acabeaaf 100644 +--- a/setup.py ++++ b/setup.py +@@ -268,9 +268,11 @@ def is_64_bit_python(): + + rust_features = [] + if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): +- rust_features.append("crashtracker") ++ rust_features.append("pyo3/extension-module") + rust_features.append("profiling") + ++ if platform.machine() not in ("ppc64le", "ppc64"): ++ rust_features.append("crashtracker") + + class PatchedDistribution(Distribution): + def __init__(self, attrs=None): +@@ -616,8 +618,8 @@ class CustomBuildExt(build_ext): + def run(self): + self.build_rust() + +- # Build libdd_wrapper before building other extensions that depend on it +- if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): ++ # Build libdd_wrapper only when profiling is enabled ++ if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python() and "profiling" in rust_features: + self.build_libdd_wrapper() + + super().run() diff --git a/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch b/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch new file mode 100644 index 0000000000..c879ba03c9 --- /dev/null +++ b/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch @@ -0,0 +1,18 @@ +diff --git a/libdd-crashtracker/src/collector/emitters.rs b/libdd-crashtracker/src/collector/emitters.rs +index f609c9f9..cbbdd56a 100644 +--- a/libdd-crashtracker/src/collector/emitters.rs ++++ b/libdd-crashtracker/src/collector/emitters.rs +@@ -384,6 +384,13 @@ fn extract_ip(ucontext: *const ucontext_t) -> usize { + return (*ucontext).uc_mcontext.gregs[libc::REG_RIP as usize] as usize; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + return (*ucontext).uc_mcontext.pc as usize; ++ ++ #[cfg(all(target_os = "linux", any(target_arch = "powerpc64", target_arch = "powerpc64le")))] ++ return unsafe { ++ let regs = (*ucontext).uc_mcontext.regs as *const u64; ++ *regs.add(32) ++ } as usize; ++ + } + } +