Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43e1004b15 | ||
|
|
e57401677f | ||
|
|
f0d71a9441 | ||
|
|
edfdd28619 | ||
|
|
7f7d490de6 | ||
|
|
e7e28fd76d | ||
|
|
730dc832b0 | ||
|
|
7cecd16dc9 | ||
|
|
2d056396a8 | ||
|
|
86efe1122c | ||
|
|
c7bff5448a | ||
| cea7bc59f3 | |||
| db5b989aad |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,2 @@
|
|||||||
/docker-stacks
|
/docker-stacks
|
||||||
jupyterhub-data
|
|
||||||
*.tar
|
*.tar
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
FROM debian:bullseye
|
FROM debian:bullseye
|
||||||
ARG CREATE_USER="jovyan"
|
ARG CREATE_USER="jovyan"
|
||||||
ARG CREATE_USER_PASSWD="password"
|
ARG CREATE_USER_PASSWD="password"
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ ARG ROOT_PASSWD="password"
|
|||||||
ARG HOME="/home/${CREATE_USER}"
|
ARG HOME="/home/${CREATE_USER}"
|
||||||
ARG DEBIAN_FRONTEND="noninteractive"
|
ARG DEBIAN_FRONTEND="noninteractive"
|
||||||
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
||||||
ARG NODEJS_VERSION='18'
|
|
||||||
ENV NODEJS_VERSION=${NODEJS_VERSION}
|
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
@@ -21,8 +19,6 @@ apt-get install -y tzdata
|
|||||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||||
echo 'Asia/Shanghai' > /etc/timezone
|
echo 'Asia/Shanghai' > /etc/timezone
|
||||||
dpkg-reconfigure -f noninteractive tzdata
|
dpkg-reconfigure -f noninteractive tzdata
|
||||||
sudo apt-get remove --purge libnode72:amd64 -y
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_${NODEJS_VERSION}.x | sudo -E bash -
|
|
||||||
# 安装所需的软件包
|
# 安装所需的软件包
|
||||||
apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm gdebi-core curl wget openssh-server vim lrzsz net-tools sudo git
|
apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm gdebi-core curl wget openssh-server vim lrzsz net-tools sudo git
|
||||||
# 创建新用户
|
# 创建新用户
|
||||||
@@ -33,26 +29,17 @@ EOT
|
|||||||
|
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
mkdir -p ~/.pip
|
||||||
|
echo "
|
||||||
|
[global]
|
||||||
|
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||||
|
|
||||||
|
[install]
|
||||||
|
trusted-host=mirrors.aliyun.com
|
||||||
|
" >> ~/.pip/pip.conf
|
||||||
# 安装 Jupyter 和相关软件
|
# 安装 Jupyter 和相关软件
|
||||||
npm install -g configurable-http-proxy yarn --registry=https://registry.npmmirror.com
|
npm install -g configurable-http-proxy
|
||||||
python3 -m pip install ipython jupyter_packaging jupyterhub jupyterlab notebook radian pycurl jupyter-rsession-proxy \
|
python3 -m pip install jupyterhub jupyterlab notebook radian pycurl jupyter-rsession-proxy ipykernel jupyterlab-language-pack-zh-CN jupyterlab-git jupyterlab-system-monitor jupyter_nbextensions_configurator jupyter_contrib_nbextensions jupyterlab-unfold jupyterlab_widgets jupyterlab-drawio jupyterlab-spreadsheet-editor jupyterlab-cell-flash jedi-language-server jupyterlab_code_formatter jupyterlab-spellchecker jupyterlab_vim nbresuse ipydrawio jedi ipympl black isort theme-darcula ipywidgets tensorboard jupyterlab_latex jupyter_bokeh autopep8 xeus-python jupyterlab-lsp python-lsp-server nglview dockerspawner jupyterhub-nativeauthenticator lckr_jupyterlab_variableinspector
|
||||||
ipykernel jupyterlab-language-pack-zh-CN jupyterlab-git jupyterlab-system-monitor jupyter_nbextensions_configurator \
|
|
||||||
jupyter_contrib_nbextensions jupyterlab-unfold jupyterlab_widgets jupyterlab-drawio jupyterlab-spreadsheet-editor \
|
|
||||||
jupyterlab-cell-flash jedi-language-server jupyterlab_code_formatter jupyterlab-spellchecker jupyterlab_vim nbresuse \
|
|
||||||
ipydrawio jedi ipympl black isort theme-darcula ipywidgets tensorboard jupyterlab_latex jupyter_bokeh autopep8 \
|
|
||||||
xeus-python jupyterlab-lsp python-lsp-server dockerspawner jupyterhub-nativeauthenticator lckr_jupyterlab_variableinspector -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
|
||||||
git clone https://ghproxy.dockless.eu.org/https://github.com/arose/nglview
|
|
||||||
cd nglview
|
|
||||||
python3 setup.py install
|
|
||||||
cd js
|
|
||||||
rm -rf node_modules package-lock.json
|
|
||||||
npm install typescript@latest --registry=https://registry.npmmirror.com
|
|
||||||
npm install --registry=https://registry.npmmirror.com
|
|
||||||
cd ../..
|
|
||||||
python -m ipykernel install --sys-prefix
|
|
||||||
jupyter nbextension enable --py --sys-prefix widgetsnbextension
|
|
||||||
jupyter nbextension enable --py --sys-prefix nglview
|
|
||||||
jupyter-nbextension enable nglview --py --sys-prefix
|
|
||||||
# 创建 JupyterHub 配置目录
|
# 创建 JupyterHub 配置目录
|
||||||
mkdir -p /root/.jupyterhub
|
mkdir -p /root/.jupyterhub
|
||||||
EOT
|
EOT
|
||||||
@@ -73,9 +60,22 @@ sudo wget "https://download2.rstudio.org/server/$(lsb_release -cs)/amd64/rstudio
|
|||||||
sudo chmod +x /tmp/rstudio-server.deb
|
sudo chmod +x /tmp/rstudio-server.deb
|
||||||
sudo gdebi -n /tmp/rstudio-server.deb
|
sudo gdebi -n /tmp/rstudio-server.deb
|
||||||
sudo rm -rf /tmp/rstudio-server.deb
|
sudo rm -rf /tmp/rstudio-server.deb
|
||||||
|
EOT
|
||||||
|
|
||||||
|
RUN <<EOT
|
||||||
|
#!/bin/bash
|
||||||
|
# 安装micromamba
|
||||||
|
echo "1" | bash <(curl -s https://raw.githubusercontent.com/hotwa/MicroMamba_Installer/main/install.sh)
|
||||||
|
mkdir -p /root/workspace/personal /root/workspace/project
|
||||||
|
EOT
|
||||||
|
|
||||||
|
RUN <<EOT
|
||||||
|
#!/bin/bash
|
||||||
# 清理和减小镜像大小
|
# 清理和减小镜像大小
|
||||||
apt-get clean
|
apt-get clean
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man/?? /usr/share/man/??_*
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man/?? /usr/share/man/??_*
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"]
|
CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"]
|
||||||
@@ -12,7 +12,7 @@ services:
|
|||||||
args:
|
args:
|
||||||
JUPYTERHUB_VERSION: latest
|
JUPYTERHUB_VERSION: latest
|
||||||
restart: always
|
restart: always
|
||||||
image: quay.io/hotwa/jupyterhub:latest
|
image: hotwa/jupyterhub # registry.cn-hangzhou.aliyuncs.com/hotwa/jupyterhub
|
||||||
container_name: jupyterhub
|
container_name: jupyterhub
|
||||||
networks:
|
networks:
|
||||||
- jupyterhub-network
|
- jupyterhub-network
|
||||||
@@ -23,17 +23,16 @@ services:
|
|||||||
# within the container
|
# within the container
|
||||||
- "/var/run/docker.sock:/var/run/docker.sock:rw"
|
- "/var/run/docker.sock:/var/run/docker.sock:rw"
|
||||||
# Bind Docker volume on host for JupyterHub database and cookie secrets
|
# Bind Docker volume on host for JupyterHub database and cookie secrets
|
||||||
- "./jupyterhub-data:/data"
|
- "jupyterhub-data:/data"
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
- "8080:8080"
|
|
||||||
environment:
|
environment:
|
||||||
# This username will be a JupyterHub admin
|
# This username will be a JupyterHub admin
|
||||||
JUPYTERHUB_ADMIN: admin
|
JUPYTERHUB_ADMIN: admin
|
||||||
# All containers will join this network
|
# All containers will join this network
|
||||||
DOCKER_NETWORK_NAME: jupyterhub-network
|
DOCKER_NETWORK_NAME: jupyterhub-network
|
||||||
# JupyterHub will spawn this Notebook image for users
|
# JupyterHub will spawn this Notebook image for users
|
||||||
DOCKER_NOTEBOOK_IMAGE: quay.io/hotwa/notebook:latest
|
DOCKER_NOTEBOOK_IMAGE: hotwa/notebook:latest
|
||||||
# Notebook directory inside user image
|
# Notebook directory inside user image
|
||||||
DOCKER_NOTEBOOK_DIR: /home/jovyan/work
|
DOCKER_NOTEBOOK_DIR: /home/jovyan/work
|
||||||
|
|
||||||
|
|||||||
49
id_rsa
Executable file
49
id_rsa
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
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
|
||||||
|
-----END OPENSSH PRIVATE KEY-----
|
||||||
@@ -10,21 +10,7 @@ c = get_config() # noqa: F821
|
|||||||
# avoid having to rebuild the JupyterHub container every time we change a
|
# avoid having to rebuild the JupyterHub container every time we change a
|
||||||
# configuration parameter.
|
# configuration parameter.
|
||||||
|
|
||||||
# from dockerspawner import DockerSpawner
|
|
||||||
|
|
||||||
# class MyDockerSpawner(DockerSpawner):
|
|
||||||
# def start(self):
|
|
||||||
# # 启动父类的start方法
|
|
||||||
# self.user_options['environment']['JUPYTER_ENABLE_NBEXTENSIONS'] = 'true'
|
|
||||||
# self.user_options['cmd'] = [
|
|
||||||
# 'bash',
|
|
||||||
# '-c',
|
|
||||||
# 'pip install nglview jupyter_packaging -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com && jupyter nbextension enable nglview --py --sys-prefix && jupyter labextension install nglview-js-widgets && jupyter labextension install @jupyter-widgets/jupyterlab-manager && start-singleuser.sh'
|
|
||||||
# ]
|
|
||||||
# return super().start()
|
|
||||||
|
|
||||||
# Spawn single-user servers as Docker containers
|
# Spawn single-user servers as Docker containers
|
||||||
c.Authenticator.allow_all = True
|
|
||||||
c.JupyterHub.spawner_class = "dockerspawner.DockerSpawner"
|
c.JupyterHub.spawner_class = "dockerspawner.DockerSpawner"
|
||||||
|
|
||||||
# Spawn containers from this image
|
# Spawn containers from this image
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ http {
|
|||||||
|
|
||||||
map $http_upgrade $connection_upgrade {
|
map $http_upgrade $connection_upgrade {
|
||||||
default upgrade;
|
default upgrade;
|
||||||
'' close;
|
'' close;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
@@ -33,7 +33,6 @@ http {
|
|||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_set_header X-Forwarded-Port $server_port; # 添加这一行,保持原有的端口号
|
|
||||||
|
|
||||||
# WebSocket support
|
# WebSocket support
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ ARG ROOT_PASSWD="password"
|
|||||||
ARG HOME="/home/${CREATE_USER}"
|
ARG HOME="/home/${CREATE_USER}"
|
||||||
ARG DEBIAN_FRONTEND="noninteractive"
|
ARG DEBIAN_FRONTEND="noninteractive"
|
||||||
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
||||||
ARG NODEJS_VERSION='18'
|
|
||||||
ENV NODEJS_VERSION=${NODEJS_VERSION}
|
|
||||||
|
|
||||||
COPY install.sh /tmp
|
COPY install.sh /tmp
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
@@ -92,10 +90,7 @@ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|||||||
echo 'Asia/Shanghai' > /etc/timezone
|
echo 'Asia/Shanghai' > /etc/timezone
|
||||||
dpkg-reconfigure -f noninteractive tzdata
|
dpkg-reconfigure -f noninteractive tzdata
|
||||||
# 安装所需的软件包
|
# 安装所需的软件包
|
||||||
sudo apt-get remove --purge libnode72:amd64 -y
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_${NODEJS_VERSION}.x | sudo -E bash -
|
|
||||||
apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm gdebi-core curl wget openssh-server vim lrzsz net-tools sudo git nodejs
|
apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm gdebi-core curl wget openssh-server vim lrzsz net-tools sudo git nodejs
|
||||||
npm install -g configurable-http-proxy yarn --registry=https://registry.npmmirror.com
|
|
||||||
# 创建新用户
|
# 创建新用户
|
||||||
useradd -m -s /bin/bash ${CREATE_USER}
|
useradd -m -s /bin/bash ${CREATE_USER}
|
||||||
echo "${CREATE_USER}:${CREATE_USER_PASSWD}" | chpasswd
|
echo "${CREATE_USER}:${CREATE_USER_PASSWD}" | chpasswd
|
||||||
@@ -105,7 +100,11 @@ EOT
|
|||||||
# 安装 Jupyter 和相关软件
|
# 安装 Jupyter 和相关软件
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
python3 -m pip install ipython jupyterhub jupyterlab notebook jupyter_packaging -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
npm install -g configurable-http-proxy
|
||||||
|
git clone https://github.com/arose/nglview
|
||||||
|
cd nglview
|
||||||
|
python setup.py install
|
||||||
|
cd ..
|
||||||
python3 -m pip install aiohttp -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
python3 -m pip install aiohttp -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
||||||
python3 -m pip install jupyterhub jupyterlab notebook radian pycurl aiohttp jupyter-rsession-proxy ipykernel>=6.25.0 jupyterlab-language-pack-zh-CN jupyterlab-git jupyterlab-system-monitor jupyter_nbextensions_configurator jupyter_contrib_nbextensions jupyterlab_widgets jupyterlab-drawio jupyterlab-spreadsheet-editor jupyterlab-cell-flash jedi-language-server jupyterlab_code_formatter jupyterlab-spellchecker jupyterlab_vim nbresuse ipydrawio jedi ipympl black isort theme-darcula ipywidgets tensorboard jupyterlab_latex jupyter_bokeh autopep8 xeus-python jupyterlab-lsp python-lsp-server dockerspawner jupyterhub-nativeauthenticator lckr_jupyterlab_variableinspector -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
python3 -m pip install jupyterhub jupyterlab notebook radian pycurl aiohttp jupyter-rsession-proxy ipykernel>=6.25.0 jupyterlab-language-pack-zh-CN jupyterlab-git jupyterlab-system-monitor jupyter_nbextensions_configurator jupyter_contrib_nbextensions jupyterlab_widgets jupyterlab-drawio jupyterlab-spreadsheet-editor jupyterlab-cell-flash jedi-language-server jupyterlab_code_formatter jupyterlab-spellchecker jupyterlab_vim nbresuse ipydrawio jedi ipympl black isort theme-darcula ipywidgets tensorboard jupyterlab_latex jupyter_bokeh autopep8 xeus-python jupyterlab-lsp python-lsp-server dockerspawner jupyterhub-nativeauthenticator lckr_jupyterlab_variableinspector -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
||||||
EOT
|
EOT
|
||||||
@@ -139,58 +138,23 @@ USER ${NB_UID}
|
|||||||
ARG MODULAR_HOME="/home/${CREATE_USER}/.modular"
|
ARG MODULAR_HOME="/home/${CREATE_USER}/.modular"
|
||||||
ENV MODULAR_HOME=$MODULAR_HOME
|
ENV MODULAR_HOME=$MODULAR_HOME
|
||||||
ENV PATH="$MODULAR_HOME/pkg/packages.modular.com_mojo/bin:/home/${CREATE_USER}/.local/bin:$PATH"
|
ENV PATH="$MODULAR_HOME/pkg/packages.modular.com_mojo/bin:/home/${CREATE_USER}/.local/bin:$PATH"
|
||||||
ARG HTTP_PROXY=""
|
|
||||||
ARG HTTPS_PROXY=""
|
|
||||||
ARG NO_PROXY="localhost,127.0.0.1"
|
|
||||||
ENV HTTP_PROXY=$HTTP_PROXY
|
|
||||||
ENV HTTPS_PROXY=$HTTPS_PROXY
|
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
curl --retry 5 https://get.modular.com | sh -
|
curl https://get.modular.com | sh -
|
||||||
mamba create -n mojo python=3.10 ipykernel ipython nglview -c conda-forge -y
|
mamba create -n mojo python=3.10 -c conda-forge -y
|
||||||
mamba activate mojo && modular install mojo
|
mamba activate mojo
|
||||||
mamba run -n mojo python -m ipykernel install --user --name="mojo" --display-name="mojo_env"
|
modular install mojo
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
# Install Rust https://rsproxy.cn/#getStarted
|
# Install Rust
|
||||||
ENV RUSTUP_DIST_SERVER="https://rsproxy.cn"
|
|
||||||
ENV RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
|
|
||||||
ENV PATH="/home/${CREATE_USER}/.cargo/bin:$PATH"
|
ENV PATH="/home/${CREATE_USER}/.cargo/bin:$PATH"
|
||||||
ENV CARGO_UNSTABLE_SPARSE_REGISTRY="true"
|
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh -s -- -y
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
echo '[source.crates-io]
|
|
||||||
replace-with = "rsproxy-sparse"
|
|
||||||
[source.rsproxy]
|
|
||||||
registry = "https://rsproxy.cn/crates.io-index"
|
|
||||||
[source.rsproxy-sparse]
|
|
||||||
registry = "sparse+https://rsproxy.cn/index/"
|
|
||||||
[registries.rsproxy]
|
|
||||||
index = "https://rsproxy.cn/crates.io-index"
|
|
||||||
[net]
|
|
||||||
git-fetch-with-cli = true' >> ~/.cargo/config.toml
|
|
||||||
source $HOME/.cargo/env
|
source $HOME/.cargo/env
|
||||||
cargo install evcxr_jupyter
|
cargo install evcxr_jupyter
|
||||||
evcxr_jupyter --install
|
evcxr_jupyter --install
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
RUN <<EOT
|
|
||||||
#!/bin/bash
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y texlive-full
|
|
||||||
mamba create -n torch tensorboard jupyter_packaging pytorch biopython biopandas pymol-open-source mdtraj torchvision torchaudio python=3 ipython requests scienceplots autopep8 ipykernel\
|
|
||||||
pandas numpy matplotlib scipy seaborn orange3 -c pytorch -c nvidia -c conda-forge -y
|
|
||||||
git clone https://ghproxy.dockless.eu.org/https://github.com/arose/nglview
|
|
||||||
cd nglview
|
|
||||||
mamba run -n torch python3 setup.py install
|
|
||||||
cd js
|
|
||||||
rm -rf node_modules package-lock.json
|
|
||||||
npm install typescript@latest --registry=https://registry.npmmirror.com
|
|
||||||
npm install --registry=https://registry.npmmirror.com
|
|
||||||
cd ../..
|
|
||||||
mamba run -n torch python -m ipykernel install --user --name="torch" --display-name="torch_env"
|
|
||||||
EOT
|
|
||||||
|
|
||||||
WORKDIR "${HOME}"
|
WORKDIR "${HOME}"
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ ENV ROOT_PASSWD=${ROOT_PASSWD}
|
|||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
|
ENV STAGE_DIR=/tmp
|
||||||
# https://network.nvidia.com/products/infiniband-drivers/linux/mlnx_ofed/
|
# https://network.nvidia.com/products/infiniband-drivers/linux/mlnx_ofed/
|
||||||
ENV MLNX_OFED_VERSION=23.10-3.2.2.0
|
ENV MLNX_OFED_VERSION=23.10-3.2.2.0
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
@@ -29,34 +30,53 @@ python3 -m pip uninstall -y deepspeed
|
|||||||
# from https://github.com/huggingface/transformers/blob/main/docker/transformers-pytorch-deepspeed-latest-gpu/Dockerfile install deepspeed fail
|
# from https://github.com/huggingface/transformers/blob/main/docker/transformers-pytorch-deepspeed-latest-gpu/Dockerfile install deepspeed fail
|
||||||
# reference deepspeed install from https://github.com/microsoft/DeepSpeed/blob/master/docker/Dockerfile
|
# reference deepspeed install from https://github.com/microsoft/DeepSpeed/blob/master/docker/Dockerfile
|
||||||
# install deepspeed prepare
|
# install deepspeed prepare
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y libnvidia-compute-535
|
||||||
|
apt-get install -y flex tk ethtool libpci3 libltdl-dev bison lsof tcl libelf1 pciutils kmod libmnl0 debhelper libusb-1.0-0 graphviz chrpath swig libfuse2 udev
|
||||||
# install Mellanox OFED
|
# install Mellanox OFED
|
||||||
mkdir -p ${STAGE_DIR}
|
mkdir -p ${STAGE_DIR}
|
||||||
|
cd ${STAGE_DIR}
|
||||||
wget -q -O - http://www.mellanox.com/downloads/ofed/MLNX_OFED-${MLNX_OFED_VERSION}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64.tgz | tar xzf -
|
wget -q -O - http://www.mellanox.com/downloads/ofed/MLNX_OFED-${MLNX_OFED_VERSION}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64.tgz | tar xzf -
|
||||||
cd MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64
|
cd ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64
|
||||||
./mlnxofedinstall --user-space-only --without-fw-update --all -q
|
./mlnxofedinstall --user-space-only --without-fw-update --all -q > /tmp/mlnxofedinstall.log 2>&1
|
||||||
cd ${STAGE_DIR}
|
cd ${STAGE_DIR}
|
||||||
rm -rf ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64*
|
# rm -rf ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64*
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
ARG NV_PEER_MEM_VERSION="1.2"
|
ARG NV_PEER_MEM_VERSION="1.2"
|
||||||
ENV NV_PEER_MEM_VERSION=${NV_PEER_MEM_VERSION}
|
ENV NV_PEER_MEM_VERSION=${NV_PEER_MEM_VERSION}
|
||||||
ENV NV_PEER_MEM_TAG=${NV_PEER_MEM_VERSION}-0
|
ENV NV_PEER_MEM_TAG=${NV_PEER_MEM_VERSION}-0
|
||||||
RUN <<EOT
|
RUN mkdir -p ${STAGE_DIR} && \
|
||||||
#!/bin/bash
|
git clone https://github.com/Mellanox/nv_peer_memory.git --branch ${NV_PEER_MEM_TAG} ${STAGE_DIR}/nv_peer_memory && \
|
||||||
# install nv_peer_mem
|
cd ${STAGE_DIR}/nv_peer_memory && \
|
||||||
mkdir -p ${STAGE_DIR}
|
./build_module.sh && \
|
||||||
git clone https://github.com/Mellanox/nv_peer_memory.git --branch ${NV_PEER_MEM_TAG} ${STAGE_DIR}/nv_peer_memory
|
cd ${STAGE_DIR} && \
|
||||||
cd ${STAGE_DIR}/nv_peer_memory
|
tar xzf ${STAGE_DIR}/nvidia-peer-memory_${NV_PEER_MEM_VERSION}.orig.tar.gz && \
|
||||||
./build_module.sh
|
cd ${STAGE_DIR}/nvidia-peer-memory-${NV_PEER_MEM_VERSION} && \
|
||||||
cd ${STAGE_DIR}
|
apt-get update && \
|
||||||
tar xzf ${STAGE_DIR}/nvidia-peer-memory_${NV_PEER_MEM_VERSION}.orig.tar.gz
|
apt-get --fix-broken install -y && \
|
||||||
cd ${STAGE_DIR}/nvidia-peer-memory-${NV_PEER_MEM_VERSION}
|
apt-get install -y dkms && \
|
||||||
apt-get update
|
dpkg-buildpackage -us -uc && \
|
||||||
apt --fix-broken install -y
|
dpkg -i ${STAGE_DIR}/nvidia-peer-memory_${NV_PEER_MEM_TAG}_all.deb
|
||||||
apt-get install -y dkms
|
|
||||||
dpkg-buildpackage -us -uc
|
# ENV NV_PEER_MEM_VERSION=${NV_PEER_MEM_VERSION}
|
||||||
dpkg -i ${STAGE_DIR}/nvidia-peer-memory_${NV_PEER_MEM_TAG}_all.deb
|
# ENV NV_PEER_MEM_TAG=${NV_PEER_MEM_VERSION}-0
|
||||||
EOT
|
# RUN <<EOT
|
||||||
|
# #!/bin/bash
|
||||||
|
# # install nv_peer_mem
|
||||||
|
# mkdir -p ${STAGE_DIR}
|
||||||
|
# git clone https://github.com/Mellanox/nv_peer_memory.git --branch ${NV_PEER_MEM_TAG} ${STAGE_DIR}/nv_peer_memory
|
||||||
|
# cd ${STAGE_DIR}/nv_peer_memory
|
||||||
|
# ./build_module.sh
|
||||||
|
# cd ${STAGE_DIR}
|
||||||
|
# tar xzf ${STAGE_DIR}/nvidia-peer-memory_${NV_PEER_MEM_VERSION}.orig.tar.gz
|
||||||
|
# cd ${STAGE_DIR}/nvidia-peer-memory-${NV_PEER_MEM_VERSION}
|
||||||
|
# apt-get update
|
||||||
|
# apt-get --fix-broken install -y
|
||||||
|
# apt-get install -y dkms
|
||||||
|
# dpkg-buildpackage -us -uc
|
||||||
|
# dpkg -i ${STAGE_DIR}/nvidia-peer-memory_${NV_PEER_MEM_TAG}_all.deb
|
||||||
|
# EOT
|
||||||
|
|
||||||
# base tools
|
# base tools
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
@@ -86,9 +106,9 @@ pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=
|
|||||||
pip install git+https://github.com/huggingface/transformers
|
pip install git+https://github.com/huggingface/transformers
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
ENV STAGE_DIR=/tmp
|
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
apt install -y cmake gcc g++ libssl-dev
|
||||||
git clone https://github.com/microsoft/DeepSpeed-Kernels.git ${STAGE_DIR}/DeepSpeed-Kernels
|
git clone https://github.com/microsoft/DeepSpeed-Kernels.git ${STAGE_DIR}/DeepSpeed-Kernels
|
||||||
cd ${STAGE_DIR}/DeepSpeed-Kernels
|
cd ${STAGE_DIR}/DeepSpeed-Kernels
|
||||||
python -m pip install -v .
|
python -m pip install -v .
|
||||||
@@ -142,6 +162,9 @@ python -m pip install black~=23.1 ruff==0.1.5 diffusers>=0.17.0
|
|||||||
python -m pip install --no-deps git+https://github.com/huggingface/optimum.git#egg=optimum[diffusers,quality]
|
python -m pip install --no-deps git+https://github.com/huggingface/optimum.git#egg=optimum[diffusers,quality]
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
|
||||||
|
# SSH daemon port inside container cannot conflict with host OS port
|
||||||
|
ENV SSH_PORT=2222
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# 项目目录中的定义通常会覆盖用户家目录中的定义
|
# 项目目录中的定义通常会覆盖用户家目录中的定义
|
||||||
@@ -156,6 +179,8 @@ CUDA_HOME=${CUDA_HOME}
|
|||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
||||||
EOF
|
EOF
|
||||||
unset https_proxy http_proxy
|
unset https_proxy http_proxy
|
||||||
|
cat /etc/ssh/sshd_config > ${STAGE_DIR}/sshd_config && \
|
||||||
|
sed "0,/^Port 22/s//Port ${SSH_PORT}/" ${STAGE_DIR}/sshd_config > /etc/ssh/sshd_config
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
CMD ["/usr/sbin/sshd", "-D"]
|
CMD ["/usr/sbin/sshd", "-D"]
|
||||||
@@ -29,7 +29,8 @@ NCCL_IB_DISABLE=0
|
|||||||
## test command
|
## test command
|
||||||
|
|
||||||
docker run -it --rm --network=host --privileged --ipc=host --ulimit memlock=-1 --gpus all hotwa/notebook:ngc
|
docker run -it --rm --network=host --privileged --ipc=host --ulimit memlock=-1 --gpus all hotwa/notebook:ngc
|
||||||
docker run --rm -it --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 hotwa/notebook:ngc /bin/bash
|
docker run --rm -it --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 nvcr.io/nvidia/pytorch:24.06-py3 /bin/bash
|
||||||
|
docker run -it --rm --network=host --privileged --ipc=host --ulimit memlock=-1 --gpus all quay.io/hotwa/ngc:latest /bin/bash
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
nvidia-smi
|
nvidia-smi
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ services:
|
|||||||
# tty: true
|
# tty: true
|
||||||
# stdin_open: true
|
# stdin_open: true
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: hotwa/notebook:ngc
|
image: quay.io/hotwa/ngc:latest
|
||||||
privileged: true
|
privileged: true
|
||||||
ipc: host
|
ipc: host
|
||||||
network_mode: host
|
network_mode: host
|
||||||
|
|||||||
Reference in New Issue
Block a user