|
1 |
| -FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04 |
2 |
| - |
3 |
| -# Install some basic utilities |
4 |
| -RUN apt-get update && apt-get install -y \ |
5 |
| - curl \ |
6 |
| - ca-certificates \ |
7 |
| - sudo \ |
8 |
| - git \ |
9 |
| - bzip2 \ |
10 |
| - libx11-6 \ |
11 |
| - && rm -rf /var/lib/apt/lists/* |
12 |
| - |
13 |
| -# Create a working directory |
14 |
| -RUN mkdir /app |
15 |
| -WORKDIR /app |
16 |
| - |
17 |
| -# Create a non-root user and switch to it |
18 |
| -RUN adduser --disabled-password --gecos '' --shell /bin/bash user \ |
19 |
| - && chown -R user:user /app |
20 |
| -RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user |
21 |
| -USER user |
22 |
| - |
23 |
| -# All users can use /home/user as their home directory |
24 |
| -ENV HOME=/home/user |
25 |
| -RUN chmod 777 /home/user |
26 |
| - |
27 |
| -# Install Miniconda and Python 3.7 |
28 |
| -ENV CONDA_AUTO_UPDATE_CONDA=false |
29 |
| -ENV PATH=/home/user/miniconda/bin:$PATH |
30 |
| -RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py37_4.8.2-Linux-x86_64.sh \ |
31 |
| - && chmod +x ~/miniconda.sh \ |
32 |
| - && ~/miniconda.sh -b -p ~/miniconda \ |
33 |
| - && rm ~/miniconda.sh \ |
34 |
| - && conda install -y python==3.7 \ |
35 |
| - && conda clean -ya |
36 |
| - |
37 |
| -# CUDA 10.2-specific steps and required library settings |
38 |
| -RUN conda install pytorch==1.5.1 torchvision==0.6.1 cudatoolkit -c pytorch \ |
39 |
| - && conda install -c conda-forge progressbar2 \ |
40 |
| - && conda clean -ya |
41 |
| - |
42 |
| -COPY requirements.txt $HOME/ |
43 |
| -COPY requirements-dev.txt $HOME/ |
44 |
| -RUN pip install -r $HOME/requirements.txt |
45 |
| -RUN pip install -r $HOME/requirements-dev.txt |
46 |
| - |
47 |
| -# Set the default command to python3 |
48 |
| -CMD ["python3"] |
| 1 | +FROM nvcr.io/nvidia/tensorrt:21.05-py3 |
| 2 | + |
| 3 | +LABEL maintainer= "Jongkuk Lim <[email protected]>" |
| 4 | + |
| 5 | +ENV DEBIAN_FRONTEND=noninteractive |
| 6 | +ENV TZ=Asia/Seoul |
| 7 | + |
| 8 | +ARG UID=1000 |
| 9 | +ARG GID=1000 |
| 10 | +RUN groupadd -g $GID -o user && useradd -m -u $UID -g $GID -o -s /bin/bash user |
| 11 | + |
| 12 | +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone |
| 13 | +RUN apt-get update && apt-get install -y sudo dialog apt-utils tzdata |
| 14 | +RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && echo "user:user" | chpasswd && adduser user sudo |
| 15 | + |
| 16 | +WORKDIR /home/user |
| 17 | +USER user |
| 18 | + |
| 19 | +# Install Display dependencies |
| 20 | +RUN sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev && sudo apt-get -y install jq |
| 21 | + |
| 22 | +# Install pip3 and C++ linter |
| 23 | +RUN sudo apt-get install -y clang-format cppcheck |
| 24 | +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py --force-reinstall && python3 -m pip install --upgrade pip |
| 25 | +RUN python3 -m pip install wheel cpplint |
| 26 | + |
| 27 | +# Install doxygen for C++ documentation |
| 28 | +RUN sudo apt-get update && sudo apt-get install -y flex bison && sudo apt-get autoremove -y |
| 29 | +RUN git clone -b Release_1_9_2 https://github.com/doxygen/doxygen.git \ |
| 30 | + && cd doxygen \ |
| 31 | + && mkdir build \ |
| 32 | + && cd build \ |
| 33 | + && cmake -G "Unix Makefiles" .. \ |
| 34 | + && make -j `cat /proc/cpuinfo | grep cores | wc -l` \ |
| 35 | + && sudo make install |
| 36 | + |
| 37 | +# Install PyTorch CUDA 11.1 |
| 38 | +RUN python3 -m pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html |
| 39 | + |
| 40 | +# Install other development dependencies |
| 41 | +COPY ./requirements-dev.txt ./ |
| 42 | +RUN python3 -m pip install -r requirements-dev.txt |
| 43 | +RUN rm requirements-dev.txt |
| 44 | + |
| 45 | +# Download libtorch |
| 46 | +RUN wget -q https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.9.1%2Bcu111.zip \ |
| 47 | + && unzip libtorch-cxx11-abi-shared-with-deps-1.9.1+cu111.zip \ |
| 48 | + && mkdir libs \ |
| 49 | + && mv libtorch libs/libtorch \ |
| 50 | + && rm libtorch-cxx11-abi-shared-with-deps-1.9.1+cu111.zip |
| 51 | + |
| 52 | +# Install cmake 3.21.0 version. |
| 53 | +RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-linux-x86_64.tar.gz \ |
| 54 | + && tar -xzvf cmake-3.21.0-linux-x86_64.tar.gz \ |
| 55 | + && sudo ln -s /home/user/cmake-3.21.0-linux-x86_64/bin/cmake /usr/bin/cmake \ |
| 56 | + && sudo ln -s /home/user/root/cmake-3.21.0-linux-x86_64/bin/ctest /usr/bin/ctest \ |
| 57 | + && sudo ln -s /home/user/root/cmake-3.21.0-linux-x86_64/bin/cpack /usr/bin/cpack \ |
| 58 | + && rm cmake-3.21.0-linux-x86_64.tar.gz |
| 59 | + |
| 60 | +# Terminal environment |
| 61 | +RUN git clone https://github.com/JeiKeiLim/my_term.git \ |
| 62 | + && cd my_term \ |
| 63 | + && ./run.sh |
| 64 | + |
| 65 | +# Fix error messages with vim plugins |
| 66 | +RUN cd /home/user/.vim_runtime/sources_non_forked && rm -rf tlib vim-fugitive && git clone https://github.com/tomtom/tlib_vim.git tlib && git clone https://github.com/tpope/vim-fugitive.git |
| 67 | + |
| 68 | +# Install vim 8.2 with YCM |
| 69 | +RUN sudo apt-get install -y software-properties-common \ |
| 70 | + && sudo add-apt-repository ppa:jonathonf/vim \ |
| 71 | + && sudo add-apt-repository ppa:ubuntu-toolchain-r/test \ |
| 72 | + && sudo apt-get update \ |
| 73 | + && sudo apt-get install -y vim g++-8 libstdc++6 |
| 74 | + |
| 75 | +RUN cd /home/user/.vim_runtime/my_plugins \ |
| 76 | + && git clone --recursive https://github.com/ycm-core/YouCompleteMe.git \ |
| 77 | + && cd YouCompleteMe \ |
| 78 | + && CC=gcc-8 CXX=g++-8 python3 install.py --clangd-completer |
| 79 | + |
| 80 | +# Install DALI |
| 81 | +RUN python3 -m pip install --extra-index-url https://developer.download.nvidia.com/compute/redist nvidia-dali-cuda110 |
| 82 | + |
| 83 | +# Add PATH |
| 84 | +RUN echo "export PATH=/home/user/.local/bin:\$PATH" >> /home/user/.bashrc |
| 85 | +RUN echo "export LC_ALL=C.UTF-8 && export LANG=C.UTF-8" >> /home/user/.bashrc |
0 commit comments