change to mojo

This commit is contained in:
2024-05-25 11:10:45 +08:00
parent d6e33de031
commit 3b3ee98f2d
2 changed files with 20 additions and 140 deletions

41
spawnerdockerfile/Dockerfile.base-notebook Normal file → Executable file
View File

@@ -90,20 +90,27 @@ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo 'Asia/Shanghai' > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# 安装所需的软件包
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 nodejs
# 创建新用户
useradd -m -s /bin/bash ${CREATE_USER}
echo "${CREATE_USER}:${CREATE_USER_PASSWD}" | chpasswd
echo "${CREATE_USER} ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
# 安装micromamba
echo "1" | bash /tmp/install.sh
mkdir -p /home/${CREATE_USER}/micromamba
chown -R ${NB_UID}:${NB_GID} /home/${CREATE_USER}/micromamba
# 安装 Jupyter 和相关软件
npm install -g configurable-http-proxy
python3 -m pip install jupyterhub jupyterlab notebook radian pycurl 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 nglview dockerspawner jupyterhub-nativeauthenticator lckr_jupyterlab_variableinspector -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
EOT
# 安装 Jupyter 和相关软件
RUN <<EOT
#!/bin/bash
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 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
ARG RSERVER_VERSION="rstudio-server-2024.04.1-748-amd64.deb"
ENV RSERVER_VERSION=${RSERVER_VERSION}
RUN <<EOT
#!/bin/bash
# install rserver
@@ -114,7 +121,7 @@ wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee
echo | add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
apt-get update
apt install -y --no-install-recommends r-base
wget "https://download2.rstudio.org/server/$(lsb_release -cs)/amd64/rstudio-server-2023.06.1-524-amd64.deb" -O /tmp/rstudio-server.deb
wget "https://download2.rstudio.org/server/$(lsb_release -cs)/amd64/${RSERVER_VERSION}" -O /tmp/rstudio-server.deb
chmod +x /tmp/rstudio-server.deb
gdebi -n /tmp/rstudio-server.deb
rm -rf /tmp/rstudio-server.deb
@@ -126,24 +133,16 @@ EOT
# Switch back to jovyan to avoid accidental container runs as root
USER ${NB_UID}
ENV MAMBA_ROOT_PREFIX=/home/${CREATE_USER}/micromamba
# install mojo
ENV PATH="/home/${CREATE_USER}/.local/bin:$PATH"
# A random default token
ARG AUTH_KEY="mut_efe460b898e3482bb6208bfcd4a51d7e"
ENV AUTH_KEY=$AUTH_KEY
RUN curl https://get.modular.com | sh - && \
modular auth $AUTH_KEY
ARG MODULAR_HOME="/home/${CREATE_USER}/.modular"
ENV MODULAR_HOME=$MODULAR_HOME
ENV PATH="$PATH:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin"
ENV PATH="$MODULAR_HOME/pkg/packages.modular.com_mojo/bin:/home/${CREATE_USER}/.local/bin:$PATH"
RUN <<EOT
#!/bin/bash
curl https://get.modular.com | sh - && \
modular auth $AUTH_KEY
curl https://get.modular.com | sh -
mamba create -n mojo python=3.10 -c conda-forge -y
mamba activate mojo
modular install mojo
EOT