remove micromamba and add new way to install mojo

This commit is contained in:
2024-05-25 11:03:27 +08:00
parent 6adc5144c7
commit d6e33de031

26
spawnerdockerfile/Dockerfile.base Normal file → Executable file
View File

@@ -79,7 +79,6 @@ ARG HOME="/home/${CREATE_USER}"
ARG DEBIAN_FRONTEND="noninteractive"
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
COPY install.sh /tmp
RUN <<EOT
#!/bin/bash
# 更新软件源
@@ -95,10 +94,6 @@ apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm gdebi-
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
@@ -106,25 +101,22 @@ 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 -y
mamba activate mojo
modular install mojo
export MOJO_PATH=$(modular config mojo.path)
export BASHRC=$( [ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" )
echo 'export MODULAR_HOME="'$HOME'/.modular"' >> "$BASHRC"
echo 'export PATH="'$MOJO_PATH'/bin:$PATH"' >> "$BASHRC"
source "$BASHRC"
EOT
# Install Rust