add
This commit is contained in:
137
spawnerdockerfile/Dockerfile.base
Normal file
137
spawnerdockerfile/Dockerfile.base
Normal file
@@ -0,0 +1,137 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
# https://github.com/jupyter/docker-stacks/blob/main/images/base-notebook/Dockerfile
|
||||
ARG REGISTRY=quay.io
|
||||
ARG OWNER=jupyter
|
||||
ARG BASE_CONTAINER=$REGISTRY/$OWNER/docker-stacks-foundation
|
||||
FROM $BASE_CONTAINER
|
||||
|
||||
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
|
||||
|
||||
# Fix: https://github.com/hadolint/hadolint/wiki/DL4006
|
||||
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
USER root
|
||||
|
||||
# Install all OS dependencies for the Server that starts but lacks all
|
||||
# features (e.g., download as all possible file formats)
|
||||
RUN apt-get update --yes && \
|
||||
apt-get install --yes --no-install-recommends \
|
||||
fonts-liberation \
|
||||
# - pandoc is used to convert notebooks to html files
|
||||
# it's not present in the aarch64 Ubuntu image, so we install it here
|
||||
pandoc \
|
||||
# - run-one - a wrapper script that runs no more
|
||||
# than one unique instance of some command with a unique set of arguments,
|
||||
# we use `run-one-constantly` to support the `RESTARTABLE` option
|
||||
run-one && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
USER ${NB_UID}
|
||||
|
||||
# Install JupyterLab, Jupyter Notebook, JupyterHub and NBClassic
|
||||
# Generate a Jupyter Server config
|
||||
# Cleanup temporary files
|
||||
# Correct permissions
|
||||
# Do all this in a single RUN command to avoid duplicating all of the
|
||||
# files across image layers when the permissions change
|
||||
WORKDIR /tmp
|
||||
RUN mamba install --yes \
|
||||
'jupyterlab' \
|
||||
'notebook' \
|
||||
'jupyterhub' \
|
||||
'nbclassic' && \
|
||||
jupyter server --generate-config && \
|
||||
mamba clean --all -f -y && \
|
||||
npm cache clean --force && \
|
||||
jupyter lab clean && \
|
||||
rm -rf "/home/${NB_USER}/.cache/yarn" && \
|
||||
fix-permissions "${CONDA_DIR}" && \
|
||||
fix-permissions "/home/${NB_USER}"
|
||||
|
||||
ENV JUPYTER_PORT=8888
|
||||
EXPOSE $JUPYTER_PORT
|
||||
|
||||
# Configure container startup
|
||||
CMD ["start-notebook.py"]
|
||||
|
||||
# Copy local files as late as possible to avoid cache busting
|
||||
COPY start-notebook.py start-notebook.sh start-singleuser.py start-singleuser.sh /usr/local/bin/
|
||||
COPY jupyter_server_config.py docker_healthcheck.py /etc/jupyter/
|
||||
|
||||
# Fix permissions on /etc/jupyter as root
|
||||
USER root
|
||||
RUN fix-permissions /etc/jupyter/
|
||||
|
||||
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
|
||||
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands
|
||||
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD /etc/jupyter/docker_healthcheck.py || exit 1
|
||||
|
||||
# here add
|
||||
ARG CREATE_USER="jovyan"
|
||||
ARG CREATE_USER_PASSWD="password"
|
||||
ARG ROOT_PASSWD="password"
|
||||
ARG HOME="/home/${CREATE_USER}"
|
||||
ARG DEBIAN_FRONTEND="noninteractive"
|
||||
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
||||
|
||||
RUN <<EOT
|
||||
#!/bin/bash
|
||||
# 更新软件源
|
||||
apt-get update
|
||||
# 安装时区数据包并设置时区
|
||||
apt-get install -y tzdata
|
||||
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
|
||||
# 创建新用户
|
||||
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 <(curl -s https://cdn.jsdelivr.net/gh/hotwa/MicroMamba_Installer@main/install.sh)
|
||||
# 安装 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
|
||||
|
||||
# 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"
|
||||
RUN <<EOT
|
||||
#!/bin/bash
|
||||
curl https://get.modular.com | sh - && \
|
||||
modular auth $AUTH_KEY
|
||||
modular install mojo
|
||||
EOT
|
||||
|
||||
# Install Rust
|
||||
ENV PATH="/home/${CREATE_USER}/.cargo/bin:$PATH"
|
||||
RUN <<EOT
|
||||
#!/bin/bash
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
source $HOME/.cargo/env
|
||||
cargo install evcxr_jupyter
|
||||
evcxr_jupyter --install
|
||||
EOT
|
||||
|
||||
WORKDIR "${HOME}"
|
||||
117
spawnerdockerfile/Dockerfile.plot
Normal file
117
spawnerdockerfile/Dockerfile.plot
Normal file
@@ -0,0 +1,117 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
# https://github.com/jupyter/docker-stacks/blob/main/images/base-notebook/Dockerfile
|
||||
ARG REGISTRY=quay.io
|
||||
ARG OWNER=jupyter
|
||||
ARG BASE_CONTAINER=$REGISTRY/$OWNER/docker-stacks-foundation
|
||||
FROM $BASE_CONTAINER
|
||||
|
||||
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
|
||||
|
||||
# Fix: https://github.com/hadolint/hadolint/wiki/DL4006
|
||||
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
USER root
|
||||
|
||||
# Install all OS dependencies for the Server that starts but lacks all
|
||||
# features (e.g., download as all possible file formats)
|
||||
RUN apt-get update --yes && \
|
||||
apt-get install --yes --no-install-recommends \
|
||||
fonts-liberation \
|
||||
# - pandoc is used to convert notebooks to html files
|
||||
# it's not present in the aarch64 Ubuntu image, so we install it here
|
||||
pandoc \
|
||||
# - run-one - a wrapper script that runs no more
|
||||
# than one unique instance of some command with a unique set of arguments,
|
||||
# we use `run-one-constantly` to support the `RESTARTABLE` option
|
||||
run-one && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
USER ${NB_UID}
|
||||
|
||||
# Install JupyterLab, Jupyter Notebook, JupyterHub and NBClassic
|
||||
# Generate a Jupyter Server config
|
||||
# Cleanup temporary files
|
||||
# Correct permissions
|
||||
# Do all this in a single RUN command to avoid duplicating all of the
|
||||
# files across image layers when the permissions change
|
||||
WORKDIR /tmp
|
||||
RUN mamba install --yes \
|
||||
'jupyterlab' \
|
||||
'notebook' \
|
||||
'jupyterhub' \
|
||||
'nbclassic' && \
|
||||
jupyter server --generate-config && \
|
||||
mamba clean --all -f -y && \
|
||||
npm cache clean --force && \
|
||||
jupyter lab clean && \
|
||||
rm -rf "/home/${NB_USER}/.cache/yarn" && \
|
||||
fix-permissions "${CONDA_DIR}" && \
|
||||
fix-permissions "/home/${NB_USER}"
|
||||
|
||||
ENV JUPYTER_PORT=8888
|
||||
EXPOSE $JUPYTER_PORT
|
||||
|
||||
# Configure container startup
|
||||
CMD ["start-notebook.py"]
|
||||
|
||||
# Copy local files as late as possible to avoid cache busting
|
||||
COPY start-notebook.py start-notebook.sh start-singleuser.py start-singleuser.sh /usr/local/bin/
|
||||
COPY jupyter_server_config.py docker_healthcheck.py /etc/jupyter/
|
||||
|
||||
# Fix permissions on /etc/jupyter as root
|
||||
USER root
|
||||
RUN fix-permissions /etc/jupyter/
|
||||
|
||||
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
|
||||
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands
|
||||
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD /etc/jupyter/docker_healthcheck.py || exit 1
|
||||
|
||||
# here add
|
||||
ARG CREATE_USER="jovyan"
|
||||
ARG CREATE_USER_PASSWD="password"
|
||||
ARG ROOT_PASSWD="password"
|
||||
ARG HOME="/home/${CREATE_USER}"
|
||||
ARG DEBIAN_FRONTEND="noninteractive"
|
||||
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
||||
|
||||
RUN <<EOT
|
||||
#!/bin/bash
|
||||
# 更新软件源
|
||||
apt-get update
|
||||
# 安装时区数据包并设置时区
|
||||
apt-get install -y tzdata
|
||||
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
|
||||
# 创建新用户
|
||||
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 <(curl -s https://cdn.jsdelivr.net/gh/hotwa/MicroMamba_Installer@main/install.sh)
|
||||
# 安装 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
|
||||
|
||||
# Switch back to jovyan to avoid accidental container runs as root
|
||||
USER ${NB_UID}
|
||||
ENV MAMBA_ROOT_PREFIX=/home/${CREATE_USER}/micromamba
|
||||
RUN <<EOT
|
||||
#!/bin/bash
|
||||
sudo apt update
|
||||
sudo apt install -y texlive-full
|
||||
micromamba create -n plot -c conda-forge scienceplots autopep8 python=3 ipykernel pandas numpy matplotlib scipy seaborn orange3 -y
|
||||
micromamba run -n plot python -m pip install bamboolib
|
||||
micromamba run -n plot python -m ipykernel install --user --name="sciplot" --display-name="SCIPlot Environment"
|
||||
EOT
|
||||
|
||||
|
||||
WORKDIR "${HOME}"
|
||||
Reference in New Issue
Block a user