@@ -15,6 +15,11 @@ ARG TORCH_VERSION
1515LABEL maintainer="JamesNULLiu jamesnulliu@gmail.com"
1616LABEL version=${IMAGE_VERSION}
1717
18+ ENV CUDA_HOME=/usr/local/cuda
19+ ENV VCPKG_ROOT=/opt/vcpkg
20+ ENV VCPKG_HOME=/opt/vcpkg
21+ ENV CONDA_HOME=/opt/miniconda3
22+
1823SHELL ["/bin/bash", "-c"]
1924
2025# Some basic tools
@@ -27,8 +32,8 @@ RUN apt-get update && apt-get upgrade -y && \
2732 fc-cache -f -v
2833
2934# Vcpkg
30- RUN cd /usr/local && git clone https://github.com/microsoft/vcpkg.git && \
31- cd vcpkg && ./bootstrap-vcpkg.sh
35+ RUN git clone https://github.com/microsoft/vcpkg.git ${VCPKG_HOME} && \
36+ cd ${VCPKG_HOME} && ./bootstrap-vcpkg.sh
3237
3338# CMake
3439RUN wget -O /tmp/kitware-archive.sh \
@@ -37,19 +42,16 @@ RUN wget -O /tmp/kitware-archive.sh \
3742 apt-get update && apt-get install -y cmake
3843
3944# LLVM
40- RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | \
41- tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
42- echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble main" | \
43- tee /etc/apt/sources.list.d/llvm.list && \
44- echo "deb-src http://apt.llvm.org/noble/ llvm-toolchain-noble main" | \
45- tee -a /etc/apt/sources.list.d/llvm.list && \
45+ RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \
46+ chmod +x /tmp/llvm.sh && \
47+ /tmp/llvm.sh ${LLVM_VERSION} && \
4648 apt-get update && apt-get install -y \
47- clang-${LLVM_VERSION} lldb-${LLVM_VERSION} \
48- clang-tools-${LLVM_VERSION} libclang-${LLVM_VERSION}-dev \
49- clang-format-${LLVM_VERSION} python3-clang-${LLVM_VERSION} \
50- clangd-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} \
51- lldb-${LLVM_VERSION} libc++-${LLVM_VERSION}-dev \
52- libc++abi-${LLVM_VERSION}-dev libomp-${LLVM_VERSION}-dev && \
49+ clang-${LLVM_VERSION} lldb-${LLVM_VERSION} \
50+ clang-tools-${LLVM_VERSION} libclang-${LLVM_VERSION}-dev \
51+ clang-format-${LLVM_VERSION} python3-clang-${LLVM_VERSION} \
52+ clangd-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} \
53+ lldb-${LLVM_VERSION} libc++-${LLVM_VERSION}-dev \
54+ libc++abi-${LLVM_VERSION}-dev libomp-${LLVM_VERSION}-dev && \
5355 ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang && \
5456 ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ && \
5557 ln -s /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd && \
@@ -61,33 +63,43 @@ RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | \
6163RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
6264
6365# Config files
64- COPY data/.vimrc data/.inputrc data/.bashrc data/.setup_env.sh data/.tmux.conf \
65- /root/
66+ COPY data/vimrc /etc/vim/vimrc
67+ # [TODO] The config files should not only be copied only to /root, but also to
68+ # /etc/skel, so that the new user can also use them. But in singularity,
69+ # /etc/skel has no effect, so I will decide what to do later.
70+ COPY data/.inputrc data/.bashrc data/.tmux.conf /root/
71+ COPY data/.inputrc data/.bashrc data/.tmux.conf /etc/skel/
6672
6773# Install Miniconda3 and conda env
6874# [TODO] Conda now uses python=3.13 in default. However, some packages (i.e.,
6975# vllm) only support python<=3.12. That's why I install python=3.12
7076# mannually here. Maybe some days later I will remove this command.
7177RUN wget -O /tmp/miniconda3.sh \
7278 https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
73- mkdir -p /root/miniconda3 && \
74- bash /tmp/miniconda3.sh -b -u -p /root/miniconda3 && \
75- \. /root/miniconda3/bin/activate && \
79+ mkdir -p ${CONDA_HOME} && \
80+ bash /tmp/miniconda3.sh -b -u -p ${CONDA_HOME} && \
81+ ${CONDA_HOME}/bin/conda tos accept && \
82+ \. ${CONDA_HOME}/bin/activate && \
7683 conda upgrade libstdcxx-ng -c conda-forge -y && \
7784 conda install -y python=3.12 && \
7885 pip3 install nvitop --no-cache-dir && \
7986 if [[ "${INSTALL_TORCH}" == "true" ]]; then \
80- TORCH_CU_VER=$(echo $CUDA_VERSION | cut -d'.' -f1,2 | tr -d '.') && \
81- pip3 install torch==${TORCH_VERSION} torchvision torchaudio \
82- --index-url "https://download.pytorch.org/whl/cu${TORCH_CU_VER}" \
83- --no-cache-dir \
87+ TORCH_CU_VER=$(echo $CUDA_VERSION | cut -d'.' -f1,2 | tr -d '.') && \
88+ pip3 install torch==${TORCH_VERSION} torchvision torchaudio \
89+ --index-url "https://download.pytorch.org/whl/cu${TORCH_CU_VER}" \
90+ --no-cache-dir \
8491 ; fi
8592
8693# Some final steps
8794RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y && \
8895 apt-get clean && rm -rf /var/lib/apt/lists/* && \
8996 conda clean --all -y && pip cache purge && \
90- git config --system --unset-all user.name || true && \
97+ git config --system --unset-all user.name || true && \
9198 git config --system --unset-all user.email || true && \
92- git config --global --unset-all user.name || true && \
99+ git config --global --unset-all user.name || true && \
93100 git config --global --unset-all user.email || true
101+
102+ COPY data/entrypoint.sh /usr/local/bin/
103+ RUN chmod +x /usr/local/bin/entrypoint.sh
104+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
105+ CMD ["bash"]
0 commit comments