11# An example, minimal Dockerfile to install dependencies in a fresh python environment with CUDA support.
22
3- FROM nvcr.io/nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04 AS build
4- COPY --from=ghcr.io/astral-sh/uv:0.6.13 /uv /usr/local/bin/uv
3+ FROM nvcr.io/nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04
54
6- ENV UV_PYTHON_INSTALL_DIR=/python
7- ENV UV_PYTHON_PREFERENCE=only-managed
85ENV UV_LINK_MODE=copy
96SHELL ["/bin/bash", "-c"]
107
11- RUN uv python install 3.12
12-
8+ RUN mkdir -p /workspace && chown -R ubuntu:ubuntu /workspace
9+ USER ubuntu
1310RUN --mount=type=cache,target=/root/.cache/uv \
1411 --mount=type=cache,target=/root/.cache/pip \
1512 --mount=type=bind,source=requirements.txt,target=/requirements.txt \
13+ --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
1614 <<EOF
1715uv venv --python 3.12 --seed /workspace/.venv
1816source /workspace/.venv/bin/activate
@@ -22,10 +20,5 @@ pip install --no-build-isolation transformer-engine[pytorch]==2.9.0
2220uv pip install -r /requirements.txt
2321EOF
2422
25- # We still need the devel image to be able to use torch.compile; otherwise, we can use the runtime image.
26- FROM nvcr.io/nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04
27- COPY --from=build --chown=ubuntu:ubuntu /python /python
28- COPY --from=build --chown=ubuntu:ubuntu --chmod=777 /workspace/.venv /workspace/.venv
2923ENV PATH="/workspace/.venv/bin:$PATH"
30- USER ubuntu
3124WORKDIR /workspace/bionemo
0 commit comments