mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-11 20:12:58 +00:00
Merge branch 'master' into asalikhov/modules
This commit is contained in:
@@ -26,6 +26,8 @@ RUN apt-get update --yes && \
|
|||||||
# the ubuntu base image is rebuilt too seldom sometimes (less than once a month)
|
# the ubuntu base image is rebuilt too seldom sometimes (less than once a month)
|
||||||
apt-get upgrade --yes && \
|
apt-get upgrade --yes && \
|
||||||
apt-get install --yes --no-install-recommends \
|
apt-get install --yes --no-install-recommends \
|
||||||
|
# - bzip2 is necessary to extract the micromamba executable.
|
||||||
|
bzip2 \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
fonts-liberation \
|
fonts-liberation \
|
||||||
locales \
|
locales \
|
||||||
@@ -81,72 +83,60 @@ RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \
|
|||||||
fix-permissions "${CONDA_DIR}"
|
fix-permissions "${CONDA_DIR}"
|
||||||
|
|
||||||
USER ${NB_UID}
|
USER ${NB_UID}
|
||||||
ARG PYTHON_VERSION=default
|
|
||||||
|
# Pin python version here, or set it to "default"
|
||||||
|
ARG PYTHON_VERSION=3.9
|
||||||
|
|
||||||
# Setup work directory for backward-compatibility
|
# Setup work directory for backward-compatibility
|
||||||
RUN mkdir "/home/${NB_USER}/work" && \
|
RUN mkdir "/home/${NB_USER}/work" && \
|
||||||
fix-permissions "/home/${NB_USER}"
|
fix-permissions "/home/${NB_USER}"
|
||||||
|
|
||||||
# Install conda as jovyan and check the sha256 sum provided on the download site
|
# Download and install Micromamba, and initialize Conda prefix.
|
||||||
WORKDIR /tmp
|
# <https://github.com/mamba-org/mamba#micromamba>
|
||||||
|
# Similar projects using Micromamba:
|
||||||
# CONDA_MIRROR is a mirror prefix to speed up downloading
|
# - Micromamba-Docker: <https://github.com/mamba-org/micromamba-docker>
|
||||||
# For example, people from mainland China could set it as
|
# - repo2docker: <https://github.com/jupyterhub/repo2docker>
|
||||||
# https://mirrors.tuna.tsinghua.edu.cn/github-release/conda-forge/miniforge/LatestRelease
|
# Install Python, Mamba, Jupyter Notebook, Lab, and Hub
|
||||||
ARG CONDA_MIRROR=https://github.com/conda-forge/miniforge/releases/latest/download
|
|
||||||
|
|
||||||
# ---- Miniforge installer ----
|
|
||||||
# Check https://github.com/conda-forge/miniforge/releases
|
|
||||||
# Package Manager and Python implementation to use (https://github.com/conda-forge/miniforge)
|
|
||||||
# We're using Mambaforge installer, possible options:
|
|
||||||
# - conda only: either Miniforge3 to use Python or Miniforge-pypy3 to use PyPy
|
|
||||||
# - conda + mamba: either Mambaforge to use Python or Mambaforge-pypy3 to use PyPy
|
|
||||||
# Installation: conda, mamba, pip
|
|
||||||
RUN set -x && \
|
|
||||||
# Miniforge installer
|
|
||||||
miniforge_arch=$(uname -m) && \
|
|
||||||
miniforge_installer="Mambaforge-Linux-${miniforge_arch}.sh" && \
|
|
||||||
wget --quiet "${CONDA_MIRROR}/${miniforge_installer}" && \
|
|
||||||
/bin/bash "${miniforge_installer}" -f -b -p "${CONDA_DIR}" && \
|
|
||||||
rm "${miniforge_installer}" && \
|
|
||||||
# Conda configuration see https://conda.io/projects/conda/en/latest/configuration.html
|
|
||||||
conda config --system --set auto_update_conda false && \
|
|
||||||
conda config --system --set show_channel_urls true && \
|
|
||||||
if [[ "${PYTHON_VERSION}" != "default" ]]; then mamba install --quiet --yes python="${PYTHON_VERSION}"; fi && \
|
|
||||||
# Pin major.minor version of python
|
|
||||||
mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \
|
|
||||||
# Using conda to update all packages: https://github.com/mamba-org/mamba/issues/1092
|
|
||||||
conda update --all --quiet --yes && \
|
|
||||||
conda clean --all -f -y && \
|
|
||||||
rm -rf "/home/${NB_USER}/.cache/yarn" && \
|
|
||||||
fix-permissions "${CONDA_DIR}" && \
|
|
||||||
fix-permissions "/home/${NB_USER}"
|
|
||||||
|
|
||||||
# Using fixed version of mamba in arm, because the latest one has problems with arm under qemu
|
|
||||||
# See: https://github.com/jupyter/docker-stacks/issues/1539
|
|
||||||
RUN set -x && \
|
|
||||||
arch=$(uname -m) && \
|
|
||||||
if [ "${arch}" == "aarch64" ]; then \
|
|
||||||
mamba install --quiet --yes \
|
|
||||||
'mamba<0.18' && \
|
|
||||||
mamba clean --all -f -y && \
|
|
||||||
fix-permissions "${CONDA_DIR}" && \
|
|
||||||
fix-permissions "/home/${NB_USER}"; \
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Install Jupyter Notebook, Lab, and Hub
|
|
||||||
# Generate a notebook server config
|
# Generate a notebook server config
|
||||||
# Cleanup temporary files
|
# Cleanup temporary files and remove Micromamba
|
||||||
# Correct permissions
|
# Correct permissions
|
||||||
# Do all this in a single RUN command to avoid duplicating all of the
|
# Do all this in a single RUN command to avoid duplicating all of the
|
||||||
# files across image layers when the permissions change
|
# files across image layers when the permissions change
|
||||||
RUN mamba install --quiet --yes \
|
COPY --chown="${NB_UID}:${NB_GID}" initial-condarc "${CONDA_DIR}/.condarc"
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN set -x && \
|
||||||
|
arch=$(uname -m) && \
|
||||||
|
if [ "${arch}" = "x86_64" ]; then \
|
||||||
|
# Should be simpler, see <https://github.com/mamba-org/mamba/issues/1437>
|
||||||
|
arch="64"; \
|
||||||
|
fi && \
|
||||||
|
wget -qO /tmp/micromamba.tar.bz2 \
|
||||||
|
"https://micromamba.snakepit.net/api/micromamba/linux-${arch}/latest" && \
|
||||||
|
tar -xvjf /tmp/micromamba.tar.bz2 --strip-components=1 bin/micromamba && \
|
||||||
|
rm /tmp/micromamba.tar.bz2 && \
|
||||||
|
PYTHON_SPECIFIER="python=${PYTHON_VERSION}" && \
|
||||||
|
if [[ "${PYTHON_VERSION}" == "default" ]]; then PYTHON_SPECIFIER="python"; fi && \
|
||||||
|
if [ "${arch}" == "aarch64" ]; then \
|
||||||
|
# Prevent libmamba from sporadically hanging on arm64 under QEMU
|
||||||
|
# <https://github.com/mamba-org/mamba/issues/1611>
|
||||||
|
./micromamba config set extract_threads 1; \
|
||||||
|
fi && \
|
||||||
|
# Install the packages
|
||||||
|
./micromamba install \
|
||||||
|
--root-prefix="${CONDA_DIR}" \
|
||||||
|
--prefix="${CONDA_DIR}" \
|
||||||
|
--yes \
|
||||||
|
"${PYTHON_SPECIFIER}" \
|
||||||
|
'mamba' \
|
||||||
'notebook' \
|
'notebook' \
|
||||||
'jupyterhub' \
|
'jupyterhub' \
|
||||||
'jupyterlab' && \
|
'jupyterlab' && \
|
||||||
|
rm micromamba && \
|
||||||
|
# Pin major.minor version of python
|
||||||
|
mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \
|
||||||
|
jupyter notebook --generate-config && \
|
||||||
mamba clean --all -f -y && \
|
mamba clean --all -f -y && \
|
||||||
npm cache clean --force && \
|
npm cache clean --force && \
|
||||||
jupyter notebook --generate-config && \
|
|
||||||
jupyter lab clean && \
|
jupyter lab clean && \
|
||||||
rm -rf "/home/${NB_USER}/.cache/yarn" && \
|
rm -rf "/home/${NB_USER}/.cache/yarn" && \
|
||||||
fix-permissions "${CONDA_DIR}" && \
|
fix-permissions "${CONDA_DIR}" && \
|
||||||
|
6
base-notebook/initial-condarc
Normal file
6
base-notebook/initial-condarc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Conda configuration see https://conda.io/projects/conda/en/latest/configuration.html
|
||||||
|
|
||||||
|
auto_update_conda: false
|
||||||
|
show_channel_urls: true
|
||||||
|
channels:
|
||||||
|
- conda-forge
|
@@ -69,11 +69,6 @@ EXCLUDED_PACKAGES = [
|
|||||||
"ca-certificates",
|
"ca-certificates",
|
||||||
"conda-forge::blas[build=openblas]",
|
"conda-forge::blas[build=openblas]",
|
||||||
"hdf5",
|
"hdf5",
|
||||||
# TODO(asalikhov)
|
|
||||||
# When we remove a workaround for arm regarding mamba, we can
|
|
||||||
# test installation of mamba as well and remove this exception.
|
|
||||||
# See: <https://github.com/jupyter/docker-stacks/issues/1539>
|
|
||||||
"mamba[version='<0.18']",
|
|
||||||
"openssl",
|
"openssl",
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"python",
|
"python",
|
||||||
|
Reference in New Issue
Block a user