Skip to content

Commit 694a9d0

Browse files
authored
Microsoft Build 2025 demo. Serverless GPU Local Embeddings on Azure (NVIDIA#293)
* Build 2025 GPU demo of Azure Container Embedding Application * Update README.md * Polishing
1 parent 60cabe8 commit 694a9d0

15 files changed

+1117
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#
2+
# Copyright (c) 2025, NVIDIA CORPORATION.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
18+
FROM Apache Spark 3.4.1
19+
20+
ENV RAPIDS_VERSION=25.2.0
21+
22+
RUN python -m pip install --upgrade pip
23+
24+
# Install system utilities
25+
RUN apt-get update && apt-get install -y \
26+
bind9-host \
27+
curl \
28+
iputils-ping \
29+
net-tools \
30+
mc \
31+
&& rm -rf /var/lib/apt/lists/*
32+
33+
# --- 🛠️ Install Python + CUDA/RAPIDS packages
34+
RUN pip install --no-cache-dir \
35+
torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 && \
36+
pip install --no-cache-dir \
37+
jupyterlab \
38+
findspark \
39+
pyspark \
40+
ipykernel \
41+
aiohttp \
42+
redis \
43+
sentence-transformers==2.2.2 \
44+
transformers==4.27.4 \
45+
huggingface-hub==0.13.4 \
46+
"urllib3<2" \
47+
onnxruntime-gpu \
48+
tensorrt \
49+
triton-model-navigator==0.10.1 \
50+
cudf-cu11~=${RAPIDS_VERSION} \
51+
cuml-cu11~=${RAPIDS_VERSION} \
52+
cuvs-cu11~=${RAPIDS_VERSION} \
53+
scikit-learn>=1.2.1 \
54+
black>=23.1.0 \
55+
build>=0.10.0 \
56+
isort>=5.12.0 \
57+
mypy>=1.0.0 \
58+
numpydoc \
59+
pydata-sphinx-theme \
60+
pylint \
61+
pytest \
62+
"sphinx<6.0" \
63+
"twine>=4.0.0" \
64+
matplotlib \
65+
--extra-index-url=https://pypi.nvidia.com
66+
67+
# --- 📄 Copy application code
68+
WORKDIR /opt/spark/work-dir/
69+
70+
COPY trigger-mode_sql.py /app/trigger-mode.py
71+
COPY spark-embedding.py /app/spark-embedding.py
72+
COPY switch-modes.sh /usr/local/bin/switch-modes.sh
73+
RUN chmod +x /usr/local/bin/switch-modes.sh
74+
75+
# Copy MSSQL JDBC driver
76+
COPY ./lib/mssql-jdbc-12.6.1.jre8.jar /opt/driver/mssql-jdbc-12.6.1.jre8.jar
77+
78+
# --- 📄 Copy libcuda.so.1 and link it properly
79+
COPY ./lib/cuda.so.1 /usr/lib/libcuda.so.1
80+
RUN ln -sf /usr/lib/libcuda.so.1 /usr/lib/libcuda.so
81+
82+
# --- 🧠 Install Jupyter Kernel
83+
RUN python3 -m ipykernel install --user --name=pyspark --display-name "Python (PySpark)"
84+
85+
# --- 📦 Install spark-rapids-ml
86+
RUN git clone -b branch-25.02 https://github.com/NVIDIA/spark-rapids-ml.git
87+
COPY ./spark-rapids-ml /spark-rapids-ml
88+
WORKDIR /spark-rapids-ml/python
89+
90+
RUN pip install --no-cache-dir -r requirements_dev.txt \
91+
&& pip install --no-cache-dir -e .
92+
93+
# --- ⚙️ Environment Variables
94+
ENV JUPYTER_CONFIG_DIR=/root/.jupyter \
95+
JUPYTER_RUNTIME_DIR=/root/.local/share/jupyter/runtime \
96+
PYSPARK_PYTHON=python3 \
97+
SPARK_HOME=/opt/spark \
98+
PATH="$SPARK_HOME/bin:$PATH" \
99+
PYTHONPATH="$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.9-src.zip:$PYTHONPATH" \
100+
TERM=xterm
101+
102+
# --- 🌎 Expose Jupyter port
103+
EXPOSE 8888
104+
105+
# Entrypoint
106+
ENTRYPOINT ["/usr/local/bin/switch-modes.sh"]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#
2+
# Copyright (c) 2025, NVIDIA CORPORATION.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
18+
FROM Apache Spark 3.4.1
19+
20+
ENV DEBIAN_FRONTEND=noninteractive
21+
22+
ENV RAPIDS_VERSION=25.2.0
23+
24+
#Install spark-rapids-ml
25+
26+
RUN pip install --no-cache-dir \
27+
cudf-cu11~=${RAPIDS_VERSION} \
28+
cuml-cu11~=${RAPIDS_VERSION} \
29+
cuvs-cu11~=${RAPIDS_VERSION} \
30+
numpy~=1.0 \
31+
--extra-index-url=https://pypi.nvidia.com
32+
33+
# Install fixed versions of core Hugging Face + KNN deps
34+
RUN pip install --no-cache-dir \
35+
sentence-transformers==2.2.2 \
36+
transformers==4.27.4 \
37+
huggingface-hub==0.13.4 \
38+
"urllib3<2"
39+
40+
# install python dependencies
41+
RUN pip install --no-cache-dir "scikit-learn>=1.2.1" \
42+
&& pip install --no-cache-dir "black>=23.1.0" "build>=0.10.0" "isort>=5.12.0" "mypy>=1.0.0" \
43+
numpydoc pydata-sphinx-theme pylint pytest "sphinx<6.0" "twine>=4.0.0"
44+
45+
# Copy MSSQL JDBC driver
46+
COPY ./lib/mssql-jdbc-12.6.1.jre8.jar /opt/driver/mssql-jdbc-12.6.1.jre8.jar
47+
48+
# Install Spark Rapids ML
49+
RUN git clone -b branch-25.02 https://github.com/NVIDIA/spark-rapids-ml.git
50+
COPY ./spark-rapids-ml /spark-rapids-ml
51+
WORKDIR /spark-rapids-ml/python
52+
53+
# install spark-rapids-ml with requirements_dev.txt (in case it has diverged from cache)
54+
RUN pip install --no-cache-dir -r requirements_dev.txt \
55+
&& pip install --no-cache-dir -e .
56+
57+
# Install PyTorch (CUDA 11.x version)
58+
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
59+
60+
61+
ENV TERM=xterm
62+
63+
## Install keys for Spark UI using tunneling (SOCKS proxy)
64+
# COPY sshd/authorized_keys /etc/ssh/authorized_keys
65+
# RUN chmod -R 644 /etc/ssh/authorized_keys
66+
67+
68+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#
2+
# Copyright (c) 2025, NVIDIA CORPORATION.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
18+
FROM Apache Spark 3.4.1
19+
20+
ENV DEBIAN_FRONTEND=noninteractive
21+
22+
ENV RAPIDS_VERSION=25.2.0
23+
24+
RUN python -m pip install --upgrade pip
25+
26+
# System utilities
27+
RUN apt-get update && apt-get install -y mc && rm -rf /var/lib/apt/lists/*
28+
29+
# Install all required Python packages in one go
30+
RUN pip install --no-cache-dir \
31+
torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 && \
32+
pip install --no-cache-dir \
33+
cudf-cu11~=${RAPIDS_VERSION} \
34+
cuml-cu11~=${RAPIDS_VERSION} \
35+
cuvs-cu11~=${RAPIDS_VERSION} \
36+
onnxruntime-gpu \
37+
"tensorrt" \
38+
"triton-model-navigator==0.10.1" \
39+
"sentence_transformers==2.2.2" \
40+
"urllib3<2" \
41+
"transformers==4.27.4" \
42+
"huggingface-hub==0.13.4" \
43+
"scikit-learn>=1.2.1" \
44+
"black>=23.1.0" "build>=0.10.0" "isort>=5.12.0" "mypy>=1.0.0" \
45+
numpydoc pydata-sphinx-theme pylint pytest "sphinx<6.0" "twine>=4.0.0" \
46+
--extra-index-url=https://pypi.nvidia.com
47+
48+
RUN git clone -b branch-25.02 https://github.com/NVIDIA/spark-rapids-ml.git
49+
COPY ./spark-rapids-ml /spark-rapids-ml
50+
WORKDIR /spark-rapids-ml/python
51+
52+
# install spark-rapids-ml with requirements_dev.txt (in case it has diverged from cache)
53+
RUN pip install --no-cache-dir -r requirements_dev.txt \
54+
&& pip install --no-cache-dir -e .
55+
56+
# Copy MSSQL JDBC driver
57+
COPY ./lib/mssql-jdbc-12.6.1.jre8.jar /opt/driver/mssql-jdbc-12.6.1.jre8.jar
58+
59+
ENV TERM=xterm

0 commit comments

Comments
 (0)