mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-18 15:32:56 +00:00
Cleanup of #1594
To be merged into maresb:micromamba after we see if CI passes
This commit is contained in:
@@ -10,7 +10,7 @@ ARG ROOT_CONTAINER=ubuntu:focal
|
|||||||
# Download them in a separate stage with alpine.
|
# Download them in a separate stage with alpine.
|
||||||
# Context: <https://github.com/jupyter/docker-stacks/pull/1594#issuecomment-1028426999>
|
# Context: <https://github.com/jupyter/docker-stacks/pull/1594#issuecomment-1028426999>
|
||||||
FROM alpine as download_micromamba_stage
|
FROM alpine as download_micromamba_stage
|
||||||
WORKDIR /tmp
|
# hadolint ignore=DL3018
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
arch=$(uname -m) && \
|
arch=$(uname -m) && \
|
||||||
if [ "${arch}" = "x86_64" ]; then \
|
if [ "${arch}" = "x86_64" ]; then \
|
||||||
@@ -18,8 +18,9 @@ RUN set -x && \
|
|||||||
arch="64"; \
|
arch="64"; \
|
||||||
fi && \
|
fi && \
|
||||||
echo $arch && \
|
echo $arch && \
|
||||||
apk add --no-cache curl==7.80.0-r0 && \
|
apk add --no-cache curl && \
|
||||||
curl -L "https://micromamba.snakepit.net/api/micromamba/linux-${arch}/latest" > micromamba.tar.bz2
|
curl -L "https://micromamba.snakepit.net/api/micromamba/linux-${arch}/latest" \
|
||||||
|
-o /tmp/micromamba.tar.bz2
|
||||||
## END MICROMAMBA WORKAROUND
|
## END MICROMAMBA WORKAROUND
|
||||||
|
|
||||||
FROM $ROOT_CONTAINER
|
FROM $ROOT_CONTAINER
|
||||||
@@ -58,7 +59,6 @@ RUN apt-get update --yes && \
|
|||||||
# https://github.com/krallin/tini#why-tini for details.
|
# https://github.com/krallin/tini#why-tini for details.
|
||||||
tini \
|
tini \
|
||||||
wget \
|
wget \
|
||||||
curl \
|
|
||||||
# - bzip2 is necessary to extract the micromamba executable.
|
# - bzip2 is necessary to extract the micromamba executable.
|
||||||
bzip2 && \
|
bzip2 && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
||||||
@@ -115,19 +115,14 @@ ARG PYTHON_VERSION=3.9
|
|||||||
# 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
|
||||||
WORKDIR /tmp
|
|
||||||
COPY --chown="${NB_UID}:${NB_GID}" --from=download_micromamba_stage /tmp/micromamba.tar.bz2 /tmp
|
COPY --chown="${NB_UID}:${NB_GID}" --from=download_micromamba_stage /tmp/micromamba.tar.bz2 /tmp
|
||||||
# hadolint ignore=DL4001,DL3047
|
COPY --chown="${NB_UID}:${NB_GID}" initial-condarc "${CONDA_DIR}/.condarc"
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
tar -xvjf micromamba.tar.bz2 bin/micromamba && \
|
tar -xvjf /tmp/micromamba.tar.bz2 \
|
||||||
# bin/micromamba create --prefix="${CONDA_DIR}" && \
|
--directory=/tmp --strip-components=1 bin/micromamba && \
|
||||||
PYTHON_SPECIFIER="python=${PYTHON_VERSION}" && \
|
PYTHON_SPECIFIER="python=${PYTHON_VERSION}" && \
|
||||||
if [[ "${PYTHON_VERSION}" == "default" ]]; then PYTHON_SPECIFIER="python"; fi && \
|
if [[ "${PYTHON_VERSION}" == "default" ]]; then PYTHON_SPECIFIER="python"; fi && \
|
||||||
# TODO: use `micromamba config` or report issue.
|
/tmp/micromamba install \
|
||||||
echo "show_channel_urls: true" >> "${CONDA_DIR}/.condarc" && \
|
|
||||||
echo "channels:" >> "${CONDA_DIR}/.condarc" && \
|
|
||||||
echo " - conda-forge" >> "${CONDA_DIR}/.condarc" && \
|
|
||||||
bin/micromamba install \
|
|
||||||
--root-prefix="${CONDA_DIR}" \
|
--root-prefix="${CONDA_DIR}" \
|
||||||
--prefix="${CONDA_DIR}" \
|
--prefix="${CONDA_DIR}" \
|
||||||
--quiet --yes \
|
--quiet --yes \
|
||||||
@@ -136,12 +131,9 @@ RUN set -x && \
|
|||||||
'notebook' \
|
'notebook' \
|
||||||
'jupyterhub' \
|
'jupyterhub' \
|
||||||
'jupyterlab' && \
|
'jupyterlab' && \
|
||||||
rm micromamba.tar.bz2 && \
|
rm /tmp/micromamba.tar.bz2 && \
|
||||||
# There should be just a single binary inside bin/
|
# There should be just a single binary inside bin/
|
||||||
rm bin/micromamba && \
|
rm /tmp/micromamba && \
|
||||||
rmdir bin && \
|
|
||||||
# Conda configuration see https://conda.io/projects/conda/en/latest/configuration.html
|
|
||||||
conda config --system --set auto_update_conda false && \
|
|
||||||
# Pin major.minor version of python
|
# Pin major.minor version of python
|
||||||
mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \
|
mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \
|
||||||
jupyter notebook --generate-config && \
|
jupyter notebook --generate-config && \
|
||||||
|
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
|
Reference in New Issue
Block a user