1+ # stage 1 - builder
2+ FROM registry.access.redhat.com/ubi9/ubi:9.7 AS builder
3+
4+ WORKDIR /build
5+
6+ ENV PACKAGE_NAME=agno
7+ ENV PACKAGE_VERSION=v2.6.3
8+ ENV AGNO_PATCH=https://raw.githubusercontent.com/ppc64le/build-scripts/master/a/agno/${PACKAGE_NAME}_${PACKAGE_VERSION}.patch
9+ ENV IBM_WHEEL_INDEX=https://wheels.developerfirst.ibm.com/ppc64le/linux
10+
11+ # Install System Dependencies
12+ RUN yum install -y \
13+ git make wget python3.12 python3.12-devel python3.12-pip \
14+ gcc gcc-c++ gcc-gfortran \
15+ openssl openssl-devel \
16+ libffi libffi-devel pkgconf-pkg-config \
17+ autoconf automake libtool m4 \
18+ cmake unzip \
19+ openblas-devel \
20+ zlib-devel bzip2-devel xz-devel libjpeg-turbo-devel \
21+ && yum clean all && rm -rf /var/cache/yum
22+
23+ # Install Rust
24+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
25+ ENV PATH="/root/.cargo/bin:${PATH}"
26+
27+ # Install uv
28+ RUN python3.12 -m pip install --upgrade pip && \
29+ python3.12 -m pip install uv
30+ ENV PATH="/root/.local/bin:/usr/local/bin:${PATH}"
31+
32+ # Copy patch
33+ RUN wget $AGNO_PATCH
34+
35+ # Clone Agno
36+ RUN git clone https://github.com/agno-agi/agno
37+ WORKDIR /build/agno
38+
39+ # Checkout version
40+ RUN git checkout ${PACKAGE_VERSION}
41+ RUN git apply /build/${PACKAGE_NAME}_${PACKAGE_VERSION}.patch
42+
43+ # Create virtual environment
44+ RUN uv venv .venv --python python3.12
45+ RUN .venv/bin/python -m ensurepip
46+ RUN .venv/bin/python -m pip install --upgrade pip setuptools wheel
47+ ENV VENV_PYTHON=/build/agno/.venv/bin/python
48+
49+ # Install base deps
50+ RUN uv pip install -r libs/agno/requirements.txt \
51+ --extra-index-url $IBM_WHEEL_INDEX \
52+ --index-strategy unsafe-best-match \
53+ --no-cache-dir
54+
55+ RUN uv pip install -e libs/agno[dev] \
56+ --extra-index-url $IBM_WHEEL_INDEX \
57+ --index-strategy unsafe-best-match \
58+ --no-cache-dir
59+
60+ RUN uv pip install -r libs/agno_infra/requirements.txt \
61+ --extra-index-url $IBM_WHEEL_INDEX \
62+ --index-strategy unsafe-best-match \
63+ --no-cache-dir
64+
65+ RUN uv pip install -e libs/agno_infra[dev] \
66+ --extra-index-url $IBM_WHEEL_INDEX \
67+ --index-strategy unsafe-best-match \
68+ --no-cache-dir
69+
70+ # Build SQLite 3.45
71+ RUN wget https://www.sqlite.org/2024/sqlite-autoconf-3450000.tar.gz && \
72+ tar xzf sqlite-autoconf-3450000.tar.gz && \
73+ cd sqlite-autoconf-3450000 && \
74+ ./configure --prefix=/usr/local --enable-shared && \
75+ make -j$(nproc) && \
76+ make install && \
77+ cd /build && \
78+ rm -rf sqlite-autoconf-3450000*
79+
80+ # Configure SQLite environment for builder stage
81+ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/sqlite3.conf && \
82+ ldconfig
83+
84+ RUN rm -rf /root/.cache \
85+ /root/.local/share/uv \
86+ /tmp/*
87+
88+ RUN find /build/agno/.venv -type f -name '*.pyc' -delete && \
89+ find /build/agno/.venv -type d -name '__pycache__' -exec rm -rf {} + && \
90+ rm -rf /build/agno/.venv/share \
91+ /build/agno/.venv/include
92+
93+ # Stage 2 - Runtime
94+ FROM registry.access.redhat.com/ubi9/ubi:9.7
95+
96+ WORKDIR /build/agno
97+
98+ RUN yum install -y \
99+ gcc gcc-c++ make \
100+ python3.12-devel \
101+ libffi-devel \
102+ openssl-devel \
103+ zlib-devel \
104+ bzip2-devel \
105+ xz-devel \
106+ openblas-devel \
107+ pkgconfig \
108+ git \
109+ && yum clean all
110+
111+ # Copy entire /usr/local from builder (includes SQLite 3.45 and uv)
112+ COPY --from=builder /usr/local /usr/local
113+
114+ # Configure linker for SQLite libraries
115+ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/sqlite3.conf && \
116+ ldconfig
117+
118+ COPY --from=builder /build/agno /build/agno
119+
120+ ENV PATH="/build/agno/.venv/bin:$PATH"
121+
122+ COPY entrypoint.sh /entrypoint.sh
123+ RUN chmod +x /entrypoint.sh
124+
125+ CMD ["/entrypoint.sh" ]
0 commit comments