Skip to content

Instantly share code, notes, and snippets.

@twmht
Last active March 17, 2023 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twmht/c03e43ac230af5b9cf52ec48f793f3f8 to your computer and use it in GitHub Desktop.
Save twmht/c03e43ac230af5b9cf52ec48f793f3f8 to your computer and use it in GitHub Desktop.
Dockerfile for cuda11.3+ubuntu20.04
From nvidia/cuda:11.3.0-runtime-ubuntu20.04
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common openssh-server curl sudo git -y
RUN apt-get install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev -y
RUN add-apt-repository ppa:neovim-ppa/stable && apt-get update
RUN apt-get install neovim -y
RUN apt-get install tmux -y
# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash && . ~/.nvm/nvm.sh && nvm install node && nvm alias default node
RUN curl -sSL install-node.vercel.app/lts | bash -s -- -y
RUN useradd -rm -d /home/acer -s /bin/bash -g root -G sudo -u 1001 acer
RUN echo "acer:acer" | chpasswd
USER acer
WORKDIR /home/acer
RUN curl https://pyenv.run | bash
RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
RUN echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
RUN echo 'eval "$(pyenv init -)"' >> ~/.bashrc
RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
RUN echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
RUN echo 'eval "$(pyenv init -)"' >> ~/.profile
RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
RUN echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
RUN echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
RUN echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
RUN exec $SHELL
RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" $HOME/.pyenv/bin/pyenv install 3.8.11
USER root
RUN echo "acer:acer" >> ~/passwdfile && \
chpasswd -c SHA512 < ~/passwdfile && \
rm ~/passwdfile && \
sed -i "s/#Port.*/Port 22/" /etc/ssh/sshd_config && \
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/" /etc/ssh/sshd_config && \
sed -i "s/#PasswordAuthentication.*/PasswordAuthentication yes/" /etc/ssh/sshd_config
EXPOSE 22
CMD service ssh restart && tail -f /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment