Add files via upload

This commit is contained in:
Tater Totterson
2025-09-26 19:35:09 -05:00
committed by GitHub
parent 088761cedd
commit 7137c55482
3 changed files with 74 additions and 264 deletions

View File

@@ -1,69 +1,38 @@
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04
# CUDA + cuDNN userspace from NVIDIA (no manual repo installs needed)
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
# Set environment variables for non-interactive installations and Python buffering
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
# Install system dependencies
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
wget curl git unzip software-properties-common build-essential \
libsndfile1 libffi-dev python3-dev g++ cmake gnupg && \
apt-get clean && rm -rf /var/lib/apt/lists/*
python3.10 python3.10-venv python3.10-distutils python3-pip \
git wget curl unzip ca-certificates \
build-essential g++ cmake \
libsndfile1 libffi-dev \
&& rm -rf /var/lib/apt/lists/*
# Add deadsnakes PPA for Python 3.10
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && apt-get install -y python3.10 python3.10-dev python3.10-distutils && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Use python3.10 everywhere
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# Install pip for Python 3.10
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
# Python deps
COPY requirements.txt /tmp/requirements.txt
RUN pip install --upgrade pip && pip install -r /tmp/requirements.txt
# Add NVIDIA's CUDA repository and install CUDA 12.4 Toolkit
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin && \
mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 && \
wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda-repo-ubuntu2004-12-4-local_12.4.0-550.54.14-1_amd64.deb && \
dpkg -i cuda-repo-ubuntu2004-12-4-local_12.4.0-550.54.14-1_amd64.deb && \
cp /var/cuda-repo-ubuntu2004-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/ && \
apt-get update -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true && \
apt-get -y --allow-unauthenticated install cuda-toolkit-12-4 && \
apt-get -y --allow-unauthenticated install cuda-drivers && \
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* && \
rm -f cuda-repo-ubuntu2004-12-4-local_12.4.0-550.54.14-1_amd64.deb
# Install CuDNN 9.3
RUN wget https://developer.download.nvidia.com/compute/cudnn/9.3.0/local_installers/cudnn-local-repo-ubuntu2004-9.3.0_1.0-1_amd64.deb && \
dpkg -i cudnn-local-repo-ubuntu2004-9.3.0_1.0-1_amd64.deb && \
cp /var/cudnn-local-repo-ubuntu2004-9.3.0/cudnn-*-keyring.gpg /usr/share/keyrings/ && \
apt-get update -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true && \
apt-get -y --allow-unauthenticated install cudnn && \
apt-get -y --allow-unauthenticated install cudnn-cuda-12 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* && \
rm -f cudnn-local-repo-ubuntu2004-9.3.0_1.0-1_amd64.deb
# Install Python dependencies from requirements.txt
ADD https://raw.githubusercontent.com/MasterPhooey/MicroWakeWord-Trainer-Docker/refs/heads/main/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Ensure numpy is installed for Python 3.10
RUN python3.10 -m pip install --no-cache-dir numpy==1.26.4
# Create a data directory for external mapping
# Workspace + notebook fallback
RUN mkdir -p /data
WORKDIR /data
COPY microWakeWord_training_notebook.ipynb /root/
# Copy the notebooks to a fallback location in the container
ADD https://raw.githubusercontent.com/MasterPhooey/MicroWakeWord-Trainer-Docker/refs/heads/main/basic_training_notebook.ipynb /root/basic_training_notebook.ipynb
ADD https://raw.githubusercontent.com/MasterPhooey/MicroWakeWord-Trainer-Docker/refs/heads/main/advanced_training_notebook.ipynb /root/advanced_training_notebook.ipynb
# Add the startup script from GitHub
ADD https://raw.githubusercontent.com/MasterPhooey/MicroWakeWord-Trainer-Docker/refs/heads/main/startup.sh /usr/local/bin/startup.sh
# Startup script (copies default notebook if missing, then launches JupyterLab)
COPY startup.sh /usr/local/bin/startup.sh
RUN chmod +x /usr/local/bin/startup.sh
# Ensure /data is the default directory for Jupyter
WORKDIR /data
# Expose the Jupyter Notebook port
EXPOSE 8888
# Run the startup script and start Jupyter Notebook
CMD ["/bin/bash", "-c", "/usr/local/bin/startup.sh && jupyter notebook --ip=0.0.0.0 --no-browser --allow-root --NotebookApp.token='' --notebook-dir=/data"]
# Launch Lab (tokenless for local dev; set a token if you want auth)
CMD ["/bin/bash", "-lc", "/usr/local/bin/startup.sh && \
exec jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root \
--ServerApp.token='' --ServerApp.password='' --ServerApp.root_dir=/data"]