Switch from nvidia/cuda to plain ubuntu:22.05 base image

Since this is a pure Python environment, the CUDA toolkit isn't really
necessary. The various Python packages that can use CUDA will download
and install the CUDA dependencies they need.  This shaves off at least
8gb from the final image.

The Python package install order needed to be tweaked to ensure onnxruntime,
tensorflow and torch are installed in that order.  Any other order results
in dependent cuda package clashes.

Resolves: #12
This commit is contained in:
George Joseph
2025-12-19 10:14:26 -07:00
parent 7c9c6f7a88
commit 74b36885b5
2 changed files with 11 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
# CUDA 12.6 + cuDNN devel (Ubuntu 22.04) # Standard Ubuntu base image. CUDA base images not needed.
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive \ ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \ PYTHONUNBUFFERED=1 \
@@ -26,10 +26,18 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 \
# ---- No cuDNN repo meddling needed if using TF 2.17.x ---- # ---- No cuDNN repo meddling needed if using TF 2.17.x ----
# Python deps # Python deps
# Order is important. onnxruntime, tensorflow and torch have
# to be installed in the order below or their cuda dependencies
# will conflict.
COPY requirements.txt /tmp/requirements.txt COPY requirements.txt /tmp/requirements.txt
RUN pip install --upgrade pip \ RUN pip install --upgrade pip \
&& pip install "numpy==1.26.4" "cython>=0.29.36" \ && pip install "numpy==1.26.4" "cython>=0.29.36" \
&& pip install -r /tmp/requirements.txt \ && pip install -r /tmp/requirements.txt \
&& pip install "onnxruntime-gpu[cuda]>=1.16.0" \
&& pip install "tensorflow[and-cuda]==2.18.0" \
"tensorboard==2.18.0" \
"tensorboard-data-server==0.7.2" \
"tensorflow-io-gcs-filesystem==0.37.1" \
&& pip install \ && pip install \
torch==2.7.1 \ torch==2.7.1 \
torchaudio==2.7.1 \ torchaudio==2.7.1 \
@@ -48,4 +56,4 @@ EXPOSE 8888
CMD ["/bin/bash", "-lc", "/usr/local/bin/startup.sh && \ CMD ["/bin/bash", "-lc", "/usr/local/bin/startup.sh && \
exec jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root \ exec jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root \
--ServerApp.token='' --ServerApp.password='' --ServerApp.root_dir=/data"] --ServerApp.token='' --ServerApp.password='' --ServerApp.root_dir=/data"]

View File

@@ -1,12 +1,5 @@
# --- Core training (Microwakeword) --- # --- Core training (Microwakeword) ---
# TensorFlow stack (match CUDA/cuDNN in the base image)
tensorflow==2.17.1
tensorboard==2.17.1
tensorboard-data-server==0.7.2
tensorflow-io-gcs-filesystem==0.37.1
# tensorflow-estimator not needed (remove)
numpy==1.26.4 numpy==1.26.4
scipy==1.12.0 scipy==1.12.0
librosa==0.10.2.post1 librosa==0.10.2.post1
@@ -25,7 +18,6 @@ bitstruct==8.19.0
# --- Piper sample generation --- # --- Piper sample generation ---
piper-tts>=1.2.0 piper-tts>=1.2.0
onnxruntime-gpu>=1.16.0
piper-phonemize-cross==1.2.1 piper-phonemize-cross==1.2.1
# --- Notebook / tooling --- # --- Notebook / tooling ---