|
| 1 | +FROM ghcr.io/pytorch/pytorch:2.9.1-cuda13.0-cudnn9-runtime |
| 2 | + |
| 3 | +ENV PIP_ROOT_USER_ACTION=ignore \ |
| 4 | + ACH_TUTORIAL=floating-point-emulation |
| 5 | + |
| 6 | +# Copy only requirements.txt first for better Docker layer caching. |
| 7 | +COPY tutorials/${ACH_TUTORIAL}/brev/requirements.txt /opt/requirements.txt |
| 8 | + |
| 9 | +RUN set -ex \ |
| 10 | + && `# Install Python packages` \ |
| 11 | + && pip install --no-cache-dir --root-user-action=ignore -r /opt/requirements.txt \ |
| 12 | + && rm -f /opt/requirements.txt \ |
| 13 | + && `# Install system packages` \ |
| 14 | + && apt-get update -y \ |
| 15 | + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git-lfs \ |
| 16 | + && apt-get clean -y \ |
| 17 | + && rm -rf /var/lib/apt/lists/* \ |
| 18 | + && `# Setup Bash` \ |
| 19 | + && mkdir -p ~/.local/state/._bash_history \ |
| 20 | + && `# Setup JupyterLab` \ |
| 21 | + && mkdir -p ~/.jupyter \ |
| 22 | + && ln -fs /accelerated-computing-hub/brev/jupyter-server-config.py ~/.jupyter/jupyter_server_config.py \ |
| 23 | + && mkdir -p ~/.ipython/profile_default/startup \ |
| 24 | + && ln -fs /accelerated-computing-hub/brev/ipython-startup-add-cwd-to-path.py ~/.ipython/profile_default/startup/00-add-cwd-to-path.py \ |
| 25 | + && python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements" |
| 26 | + |
| 27 | +# Install Docker |
| 28 | +RUN apt-get update -y \ |
| 29 | + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 30 | + apt-transport-https \ |
| 31 | + ca-certificates \ |
| 32 | + curl \ |
| 33 | + gnupg \ |
| 34 | + lsb-release \ |
| 35 | + && mkdir -p /etc/apt/keyrings \ |
| 36 | + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ |
| 37 | + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \ |
| 38 | + && apt-get update -y \ |
| 39 | + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 40 | + docker-ce \ |
| 41 | + docker-ce-cli \ |
| 42 | + containerd.io \ |
| 43 | + docker-buildx-plugin \ |
| 44 | + docker-compose-plugin \ |
| 45 | + && apt-get clean -y \ |
| 46 | + && rm -rf /var/lib/apt/lists/* |
| 47 | + |
| 48 | +# Install CUDA Toolkit |
| 49 | +RUN apt-get update -y \ |
| 50 | + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 51 | + build-essential \ |
| 52 | + wget \ |
| 53 | + && wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \ |
| 54 | + && dpkg -i cuda-keyring_1.1-1_all.deb \ |
| 55 | + && rm cuda-keyring_1.1-1_all.deb \ |
| 56 | + && apt-get update \ |
| 57 | + && DEBIAN_FRONTEND=noninteractive apt-get -y install cuda-toolkit-13-1 |
| 58 | + |
| 59 | +# Install MathDx |
| 60 | +RUN wget https://developer.nvidia.com/downloads/compute/cublasdx/redist/cublasdx/cuda13/nvidia-mathdx-25.12.1-cuda13.tar.gz \ |
| 61 | + && tar -xvf nvidia-mathdx-25.12.1-cuda13.tar.gz \ |
| 62 | + && rm nvidia-mathdx-25.12.1-cuda13.tar.gz \ |
| 63 | + && mv nvidia-mathdx-25.12.1-cuda13/nvidia/mathdx /opt/nvidia \ |
| 64 | + && rm -rf nvidia-mathdx-25.12.1-cuda13 |
| 65 | + |
| 66 | +COPY . /accelerated-computing-hub |
| 67 | + |
| 68 | +WORKDIR /accelerated-computing-hub/tutorials/${ACH_TUTORIAL}/notebooks |
| 69 | + |
| 70 | +RUN `# Setup Git` \ |
| 71 | + && git config --unset-all "http.https://github.com/.extraheader" || { code=$?; [ "$code" = 5 ] || exit "$code"; } \ |
| 72 | + && git config --global --add safe.directory "/accelerated-computing-hub" |
| 73 | + |
| 74 | +ENTRYPOINT ["/accelerated-computing-hub/brev/jupyter-start.bash"] |
0 commit comments