Dockerfile.cu118.torch2.0.1.py39 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ARG CUDA_VERSION="11.8.0"
  2. ARG CUDNN_VERSION="8"
  3. ARG UBUNTU_VERSION="22.04"
  4. # Base NVidia CUDA Ubuntu image
  5. FROM nvidia/cuda:$CUDA_VERSION-cudnn$CUDNN_VERSION-devel-ubuntu$UBUNTU_VERSION AS base
  6. ENV HOME /root
  7. WORKDIR $HOME
  8. ENV PYTHON_VERSION=3.9.18
  9. ENV PATH="/usr/local/cuda/bin:${PATH}"
  10. #
  11. # Install Python plus openssh, which is our minimum set of required packages.
  12. # Install useful command line utility software
  13. ARG APTPKGS="zsh wget tmux tldr nvtop vim neovim curl rsync net-tools less iputils-ping 7zip zip unzip"
  14. RUN apt-get update -y && \
  15. apt-get install -y python3 python3-pip python3-venv && \
  16. apt-get install -y --no-install-recommends openssh-server openssh-client git git-lfs && \
  17. python3 -m pip install --upgrade pip && \
  18. apt-get install -y --no-install-recommends $APTPKGS && \
  19. apt-get clean && \
  20. rm -rf /var/lib/apt/lists/*
  21. # Install Miniconda for Python env management
  22. ENV PATH="${HOME}/miniconda3/bin:${PATH}"
  23. ENV BASEPATH="${PATH}"
  24. RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
  25. && mkdir ${HOME}/.conda \
  26. && bash Miniconda3-latest-Linux-x86_64.sh -b -p ${HOME}/miniconda3 \
  27. && rm -f Miniconda3-latest-Linux-x86_64.sh
  28. # Make base conda environment
  29. ENV CONDA=pytorch
  30. RUN conda create -n "${CONDA}" python="${PYTHON_VERSION}"
  31. ENV PATH="${HOME}/miniconda3/envs/${CONDA}/bin:${BASEPATH}"
  32. # Install pytorch
  33. ARG PYTORCH="2.0.1"
  34. ARG CUDA="118"
  35. RUN pip3 install --no-cache-dir -U torch==$PYTORCH torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu$CUDA
  36. # Set up git to support LFS, and to store credentials; useful for Huggingface Hub
  37. RUN git config --global credential.helper store && \
  38. git lfs install
  39. #COPY --chmod=755 start-ssh-only.sh /start.sh
  40. WORKDIR /workspace
  41. CMD [ "tail -f /dev/null" ]