From fd0d7668372eef26bcba82a81c56a2073caa1170 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 1 Dec 2023 22:11:15 +0100 Subject: [PATCH 01/15] Automatically install latest julia version --- docs/using/selecting.md | 1 + images/minimal-notebook/Dockerfile | 1 + .../setup-scripts/setup-julia.bash | 39 ++++++++++--------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/docs/using/selecting.md b/docs/using/selecting.md index 2739930374..97fb500801 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -81,6 +81,7 @@ It contains: - Common useful utilities like [curl](https://curl.se), [git](https://git-scm.com/), + [jq](https://jqlang.github.io/jq/), [nano](https://www.nano-editor.org/) (actually `nano-tiny`), [tzdata](https://www.iana.org/time-zones), [unzip](https://code.launchpad.net/ubuntu/+source/unzip), diff --git a/images/minimal-notebook/Dockerfile b/images/minimal-notebook/Dockerfile index a0dbfc65c6..eb28f58801 100644 --- a/images/minimal-notebook/Dockerfile +++ b/images/minimal-notebook/Dockerfile @@ -19,6 +19,7 @@ RUN apt-get update --yes && \ # Common useful utilities curl \ git \ + jq \ nano-tiny \ tzdata \ unzip \ diff --git a/images/minimal-notebook/setup-scripts/setup-julia.bash b/images/minimal-notebook/setup-scripts/setup-julia.bash index 137b225f63..d3307a0fa7 100755 --- a/images/minimal-notebook/setup-scripts/setup-julia.bash +++ b/images/minimal-notebook/setup-scripts/setup-julia.bash @@ -4,31 +4,32 @@ set -exuo pipefail # - Run as the root user # - The JULIA_PKGDIR environment variable is set -# Default julia version to install if env var is not set -# Check https://julialang.org/downloads/ -JULIA_VERSION="${JULIA_VERSION:-1.9.3}" +# Get last stable version of Julia +# https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 -# Figure out what architecture we are installing in -JULIA_ARCH=$(uname -m) -JULIA_SHORT_ARCH="${JULIA_ARCH}" -if [ "${JULIA_SHORT_ARCH}" == "x86_64" ]; then - JULIA_SHORT_ARCH="x64" -fi - -# Figure out Julia Installer URL -JULIA_INSTALLER="julia-${JULIA_VERSION}-linux-${JULIA_ARCH}.tar.gz" -JULIA_MAJOR_MINOR=$(echo "${JULIA_VERSION}" | cut -d. -f 1,2) +JULIA_LATEST_STABLE_INSTALLER_URLS=$( + wget -O - -o /dev/null 'https://julialang-s3.julialang.org/bin/versions.json' | + jq ' + with_entries(select(.value.stable==true)) | + to_entries | + max_by(.key).value.files | + .[] + ' +) +JULIA_INSTALLER_URL=$( + echo "$JULIA_LATEST_STABLE_INSTALLER_URLS" | + jq "select(.triplet == \"$(uname -m)-linux-gnu\") | .url" +) # Download and install Julia cd /tmp -mkdir "/opt/julia-${JULIA_VERSION}" -curl --progress-bar --location --output "${JULIA_INSTALLER}" \ - "https://julialang-s3.julialang.org/bin/linux/${JULIA_SHORT_ARCH}/${JULIA_MAJOR_MINOR}/${JULIA_INSTALLER}" -tar xzf "${JULIA_INSTALLER}" -C "/opt/julia-${JULIA_VERSION}" --strip-components=1 -rm "${JULIA_INSTALLER}" +mkdir "/opt/julia/" +curl --progress-bar --location --output /tmp/julia.tar.gz "${JULIA_INSTALLER_URL}" +tar xzf /tmp/julia.tar.gz -C "/opt/julia" --strip-components=1 +rm /tmp/julia.tar.gz # Link Julia installed version to /usr/local/bin, so julia launches it -ln -fs /opt/julia-*/bin/julia /usr/local/bin/julia +ln -fs /opt/julia/bin/julia /usr/local/bin/julia # Tell Julia where conda libraries are mkdir -p /etc/julia From 78ad1ee2a94e8406f1e22a2c940f475f43a645a2 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 1 Dec 2023 22:13:12 +0100 Subject: [PATCH 02/15] Better text --- images/minimal-notebook/setup-scripts/setup-julia.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/minimal-notebook/setup-scripts/setup-julia.bash b/images/minimal-notebook/setup-scripts/setup-julia.bash index d3307a0fa7..f2a3fc59ff 100755 --- a/images/minimal-notebook/setup-scripts/setup-julia.bash +++ b/images/minimal-notebook/setup-scripts/setup-julia.bash @@ -4,7 +4,7 @@ set -exuo pipefail # - Run as the root user # - The JULIA_PKGDIR environment variable is set -# Get last stable version of Julia +# Get the last stable version of Julia # https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 JULIA_LATEST_STABLE_INSTALLER_URLS=$( From a130d92e3b1540541beb3fc58b2e9310dc298595 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 1 Dec 2023 23:10:58 +0100 Subject: [PATCH 03/15] Fix --- images/minimal-notebook/setup-scripts/setup-julia.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/images/minimal-notebook/setup-scripts/setup-julia.bash b/images/minimal-notebook/setup-scripts/setup-julia.bash index f2a3fc59ff..2634172488 100755 --- a/images/minimal-notebook/setup-scripts/setup-julia.bash +++ b/images/minimal-notebook/setup-scripts/setup-julia.bash @@ -7,7 +7,7 @@ set -exuo pipefail # Get the last stable version of Julia # https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 -JULIA_LATEST_STABLE_INSTALLER_URLS=$( +JULIA_LATEST_STABLE_INSTALLERS=$( wget -O - -o /dev/null 'https://julialang-s3.julialang.org/bin/versions.json' | jq ' with_entries(select(.value.stable==true)) | @@ -17,8 +17,8 @@ JULIA_LATEST_STABLE_INSTALLER_URLS=$( ' ) JULIA_INSTALLER_URL=$( - echo "$JULIA_LATEST_STABLE_INSTALLER_URLS" | - jq "select(.triplet == \"$(uname -m)-linux-gnu\") | .url" + echo "$JULIA_LATEST_STABLE_INSTALLERS" | + jq --raw-output "select(.triplet == \"$(uname -m)-linux-gnu\") | .url" ) # Download and install Julia From d2c8065068f0c828fd75c8f5b9dd32e63f0c01c7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 1 Dec 2023 23:47:08 +0100 Subject: [PATCH 04/15] Fix --- .../setup-scripts/setup-julia.bash | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/images/minimal-notebook/setup-scripts/setup-julia.bash b/images/minimal-notebook/setup-scripts/setup-julia.bash index 2634172488..ee7e367eb3 100755 --- a/images/minimal-notebook/setup-scripts/setup-julia.bash +++ b/images/minimal-notebook/setup-scripts/setup-julia.bash @@ -7,29 +7,28 @@ set -exuo pipefail # Get the last stable version of Julia # https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 -JULIA_LATEST_STABLE_INSTALLERS=$( +JULIA_LATEST_INFO=$( wget -O - -o /dev/null 'https://julialang-s3.julialang.org/bin/versions.json' | jq ' with_entries(select(.value.stable==true)) | to_entries | max_by(.key).value.files | .[] - ' -) -JULIA_INSTALLER_URL=$( - echo "$JULIA_LATEST_STABLE_INSTALLERS" | - jq --raw-output "select(.triplet == \"$(uname -m)-linux-gnu\") | .url" + ' | + jq "select(.triplet == \"$(uname -m)-linux-gnu\")" ) +JULIA_INSTALLER_URL=$(echo "${JULIA_LATEST_INFO}" | jq --raw-output ".url") +JULIA_VERSION=$(echo "${JULIA_LATEST_INFO}" | jq --raw-output ".version") # Download and install Julia cd /tmp -mkdir "/opt/julia/" +mkdir "/opt/julia-${JULIA_VERSION}" curl --progress-bar --location --output /tmp/julia.tar.gz "${JULIA_INSTALLER_URL}" -tar xzf /tmp/julia.tar.gz -C "/opt/julia" --strip-components=1 +tar xzf /tmp/julia.tar.gz -C "/opt/julia-${JULIA_VERSION}" --strip-components=1 rm /tmp/julia.tar.gz # Link Julia installed version to /usr/local/bin, so julia launches it -ln -fs /opt/julia/bin/julia /usr/local/bin/julia +ln -fs /opt/julia-*/bin/julia /usr/local/bin/julia # Tell Julia where conda libraries are mkdir -p /etc/julia From 2cd5e461db5fe398b5b8093819a6d00b96f4dccf Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Sat, 2 Dec 2023 13:43:22 +0100 Subject: [PATCH 05/15] Update setup-julia.bash --- images/minimal-notebook/setup-scripts/setup-julia.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/images/minimal-notebook/setup-scripts/setup-julia.bash b/images/minimal-notebook/setup-scripts/setup-julia.bash index ee7e367eb3..7fa7fe596c 100755 --- a/images/minimal-notebook/setup-scripts/setup-julia.bash +++ b/images/minimal-notebook/setup-scripts/setup-julia.bash @@ -21,7 +21,6 @@ JULIA_INSTALLER_URL=$(echo "${JULIA_LATEST_INFO}" | jq --raw-output ".url") JULIA_VERSION=$(echo "${JULIA_LATEST_INFO}" | jq --raw-output ".version") # Download and install Julia -cd /tmp mkdir "/opt/julia-${JULIA_VERSION}" curl --progress-bar --location --output /tmp/julia.tar.gz "${JULIA_INSTALLER_URL}" tar xzf /tmp/julia.tar.gz -C "/opt/julia-${JULIA_VERSION}" --strip-components=1 From 2b1794f550e57a57a33c83a59589fde54313273f Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Sun, 3 Dec 2023 01:25:18 +0100 Subject: [PATCH 06/15] Install plumbum --- docs/using/selecting.md | 1 + images/datascience-notebook/Dockerfile | 2 +- images/docker-stacks-foundation/Dockerfile | 5 +- images/julia-notebook/Dockerfile | 2 +- .../setup-scripts/setup-julia.py | 75 +++++++++++++++++++ 5 files changed, 81 insertions(+), 4 deletions(-) create mode 100755 images/minimal-notebook/setup-scripts/setup-julia.py diff --git a/docs/using/selecting.md b/docs/using/selecting.md index 97fb500801..928bc9826f 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -32,6 +32,7 @@ It contains: - Package managers - [conda](https://github.com/conda/conda): "cross-platform, language-agnostic binary package manager". - [mamba](https://github.com/mamba-org/mamba): "reimplementation of the conda package manager in C++". We use this package manager by default when installing packages. + - [plumbum](https://plumbum.readthedocs.io/en/latest/) to easily run command-line-tools. - Unprivileged user `jovyan` (`uid=1000`, configurable, [see options in the common features section](./common.md) of this documentation) in group `users` (`gid=100`) with ownership over the `/home/jovyan` and `/opt/conda` paths - `tini` as the container entry point diff --git a/images/datascience-notebook/Dockerfile b/images/datascience-notebook/Dockerfile index 2d49e559eb..0fe1294d89 100644 --- a/images/datascience-notebook/Dockerfile +++ b/images/datascience-notebook/Dockerfile @@ -27,7 +27,7 @@ ENV JULIA_DEPOT_PATH=/opt/julia \ JULIA_PKGDIR=/opt/julia # Setup Julia -RUN /opt/setup-scripts/setup-julia.bash +RUN /opt/setup-scripts/setup-julia.py USER ${NB_UID} diff --git a/images/docker-stacks-foundation/Dockerfile b/images/docker-stacks-foundation/Dockerfile index 3fc4ec1521..6dbfff5176 100644 --- a/images/docker-stacks-foundation/Dockerfile +++ b/images/docker-stacks-foundation/Dockerfile @@ -88,7 +88,7 @@ RUN mkdir "/home/${NB_USER}/work" && \ # Similar projects using Micromamba: # - Micromamba-Docker: # - repo2docker: -# Install Python, Mamba, and jupyter_core +# Install Python, Mamba, jupyter_core, and plumbum # Cleanup temporary files and remove Micromamba # Correct permissions # Do all this in a single RUN command to avoid duplicating all of the @@ -114,7 +114,8 @@ RUN set -x && \ --yes \ "${PYTHON_SPECIFIER}" \ 'mamba' \ - 'jupyter_core' && \ + 'jupyter_core' \ + 'plumbum' && \ 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" && \ diff --git a/images/julia-notebook/Dockerfile b/images/julia-notebook/Dockerfile index 2c982a8b17..2e68bea7f4 100644 --- a/images/julia-notebook/Dockerfile +++ b/images/julia-notebook/Dockerfile @@ -19,7 +19,7 @@ ENV JULIA_DEPOT_PATH=/opt/julia \ JULIA_PKGDIR=/opt/julia # Setup Julia -RUN /opt/setup-scripts/setup-julia.bash +RUN /opt/setup-scripts/setup-julia.py USER ${NB_UID} diff --git a/images/minimal-notebook/setup-scripts/setup-julia.py b/images/minimal-notebook/setup-scripts/setup-julia.py new file mode 100755 index 0000000000..1ebda9768c --- /dev/null +++ b/images/minimal-notebook/setup-scripts/setup-julia.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +# Requirements: +# - Run as the root user +# - The JULIA_PKGDIR environment variable is set + +import os +import platform +import shutil +from pathlib import Path + +import plumbum +import requests + +curl = plumbum.local["curl"] +ln = plumbum.local["ln"] +chown = plumbum.local["chown"] +fix_permissions = plumbum.local["fix-permissions"] + + +def unify_aarch64(platform: str) -> str: + return { + "aarch64": "aarch64", + "arm64": "aarch64", # To support local building on aarch64 Macs + "x86_64": "x86_64", + }[platform] + + +def get_latest_julia_url() -> tuple[str, str]: + # Get the last stable version of Julia + # https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 + + versions = requests.get( + "https://julialang-s3.julialang.org/bin/versions.json" + ).json() + stable_versions = {k: v for k, v in versions.items() if v["stable"]} + latest_version_files = stable_versions[max(stable_versions)]["files"] + triplet = unify_aarch64(platform.machine()) + "-linux-gnu" + file_info = [vf for vf in latest_version_files if vf["triplet"] == triplet][0] + return file_info["url"], file_info["version"] + + +def download_julia(julia_url: str) -> None: + tmp_file = Path("/tmp/julia.tar.gz") + curl["--progress-bar", "--location", "--output", tmp_file, julia_url] & plumbum.FG + shutil.unpack_archive(tmp_file, "/opt/") + tmp_file.unlink() + + +def prepare_julia(julia_version: str) -> None: + # Link Julia installed version to /usr/local/bin, so julia launches it + ( + ln["-fs", f"/opt/julia-{julia_version}/bin/julia", "/usr/local/bin/julia"] + & plumbum.FG + ) + + # Tell Julia where conda libraries are + Path("/etc/julia").mkdir() + Path("/etc/julia/juliarc.jl").write_text( + f'push!(Libdl.DL_LOAD_PATH, "{os.environ["CONDA_DIR"]}/lib")\n' + ) + + # Create JULIA_PKGDIR, where user libraries are installed + JULIA_PKGDIR = Path(os.environ["JULIA_PKGDIR"]) + JULIA_PKGDIR.mkdir() + chown[os.environ["NB_USER"], JULIA_PKGDIR] & plumbum.FG + fix_permissions[JULIA_PKGDIR] & plumbum.FG + + +if __name__ == "__main__": + julia_url, julia_version = get_latest_julia_url() + download_julia(julia_url=julia_url) + prepare_julia(julia_version=julia_version) From 21bb841fc77202ef35e5a473d90de862d233b892 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Sun, 3 Dec 2023 01:51:06 +0100 Subject: [PATCH 07/15] Better docs --- docs/using/selecting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using/selecting.md b/docs/using/selecting.md index 928bc9826f..eb8ec9e336 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -32,7 +32,7 @@ It contains: - Package managers - [conda](https://github.com/conda/conda): "cross-platform, language-agnostic binary package manager". - [mamba](https://github.com/mamba-org/mamba): "reimplementation of the conda package manager in C++". We use this package manager by default when installing packages. - - [plumbum](https://plumbum.readthedocs.io/en/latest/) to easily run command-line-tools. + - [plumbum](https://plumbum.readthedocs.io/en/latest/) to easily run command-line tools. - Unprivileged user `jovyan` (`uid=1000`, configurable, [see options in the common features section](./common.md) of this documentation) in group `users` (`gid=100`) with ownership over the `/home/jovyan` and `/opt/conda` paths - `tini` as the container entry point From f1770b2ee784340573a7ae551f2e64c1e3a6d4ab Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Sun, 3 Dec 2023 02:18:04 +0100 Subject: [PATCH 08/15] Better docs --- docs/using/selecting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using/selecting.md b/docs/using/selecting.md index eb8ec9e336..44a1681718 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -32,7 +32,7 @@ It contains: - Package managers - [conda](https://github.com/conda/conda): "cross-platform, language-agnostic binary package manager". - [mamba](https://github.com/mamba-org/mamba): "reimplementation of the conda package manager in C++". We use this package manager by default when installing packages. - - [plumbum](https://plumbum.readthedocs.io/en/latest/) to easily run command-line tools. + - [plumbum](https://github.com/tomerfiliba/plumbum): "small yet feature-rich library for shell script-like programs in Python". - Unprivileged user `jovyan` (`uid=1000`, configurable, [see options in the common features section](./common.md) of this documentation) in group `users` (`gid=100`) with ownership over the `/home/jovyan` and `/opt/conda` paths - `tini` as the container entry point From 1a15de8354513da778ff1dd8c93e5506db07c1e2 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Dec 2023 21:27:14 +0100 Subject: [PATCH 09/15] Use subprocess.check_call instead of plumbum --- .../setup-scripts/setup-julia.py | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/images/minimal-notebook/setup-scripts/setup-julia.py b/images/minimal-notebook/setup-scripts/setup-julia.py index 1ebda9768c..62909f5328 100755 --- a/images/minimal-notebook/setup-scripts/setup-julia.py +++ b/images/minimal-notebook/setup-scripts/setup-julia.py @@ -9,16 +9,11 @@ import os import platform import shutil +import subprocess from pathlib import Path -import plumbum import requests -curl = plumbum.local["curl"] -ln = plumbum.local["ln"] -chown = plumbum.local["chown"] -fix_permissions = plumbum.local["fix-permissions"] - def unify_aarch64(platform: str) -> str: return { @@ -29,8 +24,10 @@ def unify_aarch64(platform: str) -> str: def get_latest_julia_url() -> tuple[str, str]: - # Get the last stable version of Julia - # https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 + """ + Get the last stable version of Julia + Based on: https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 + """ versions = requests.get( "https://julialang-s3.julialang.org/bin/versions.json" @@ -43,17 +40,27 @@ def get_latest_julia_url() -> tuple[str, str]: def download_julia(julia_url: str) -> None: + """ + Downloads and unpacks julia + The resulting julia directory is "/opt/julia-VERSION/" + """ tmp_file = Path("/tmp/julia.tar.gz") - curl["--progress-bar", "--location", "--output", tmp_file, julia_url] & plumbum.FG + subprocess.check_call( + ["curl", "--progress-bar", "--location", "--output", tmp_file, julia_url] + ) shutil.unpack_archive(tmp_file, "/opt/") tmp_file.unlink() def prepare_julia(julia_version: str) -> None: + """ + Creates /usr/local/bin/julia symlink + Make Julia aware of conda libraries + Creates a directory for Julia user libraries + """ # Link Julia installed version to /usr/local/bin, so julia launches it - ( - ln["-fs", f"/opt/julia-{julia_version}/bin/julia", "/usr/local/bin/julia"] - & plumbum.FG + subprocess.check_call( + ["ln", "-fs", f"/opt/julia-{julia_version}/bin/julia", "/usr/local/bin/julia"] ) # Tell Julia where conda libraries are @@ -65,8 +72,8 @@ def prepare_julia(julia_version: str) -> None: # Create JULIA_PKGDIR, where user libraries are installed JULIA_PKGDIR = Path(os.environ["JULIA_PKGDIR"]) JULIA_PKGDIR.mkdir() - chown[os.environ["NB_USER"], JULIA_PKGDIR] & plumbum.FG - fix_permissions[JULIA_PKGDIR] & plumbum.FG + subprocess.check_call(["chown", os.environ["NB_USER"], JULIA_PKGDIR]) + subprocess.check_call(["fix_permissions", JULIA_PKGDIR]) if __name__ == "__main__": From dece7204b32a22afa2ceb7238b94a2a68f0ee71d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Dec 2023 21:27:49 +0100 Subject: [PATCH 10/15] Do not use dash in python filename --- images/datascience-notebook/Dockerfile | 2 +- images/julia-notebook/Dockerfile | 2 +- .../setup-scripts/{setup-julia.py => setup_julia.py} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename images/minimal-notebook/setup-scripts/{setup-julia.py => setup_julia.py} (100%) diff --git a/images/datascience-notebook/Dockerfile b/images/datascience-notebook/Dockerfile index 0fe1294d89..1d5f13adf4 100644 --- a/images/datascience-notebook/Dockerfile +++ b/images/datascience-notebook/Dockerfile @@ -27,7 +27,7 @@ ENV JULIA_DEPOT_PATH=/opt/julia \ JULIA_PKGDIR=/opt/julia # Setup Julia -RUN /opt/setup-scripts/setup-julia.py +RUN /opt/setup-scripts/setup_julia.py USER ${NB_UID} diff --git a/images/julia-notebook/Dockerfile b/images/julia-notebook/Dockerfile index 2e68bea7f4..9dbfd7fcb1 100644 --- a/images/julia-notebook/Dockerfile +++ b/images/julia-notebook/Dockerfile @@ -19,7 +19,7 @@ ENV JULIA_DEPOT_PATH=/opt/julia \ JULIA_PKGDIR=/opt/julia # Setup Julia -RUN /opt/setup-scripts/setup-julia.py +RUN /opt/setup-scripts/setup_julia.py USER ${NB_UID} diff --git a/images/minimal-notebook/setup-scripts/setup-julia.py b/images/minimal-notebook/setup-scripts/setup_julia.py similarity index 100% rename from images/minimal-notebook/setup-scripts/setup-julia.py rename to images/minimal-notebook/setup-scripts/setup_julia.py From cc2f47e82a400badda9cd4ecb9d675ce845c47fa Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Dec 2023 21:29:00 +0100 Subject: [PATCH 11/15] Remove plumbum from the image --- docs/using/selecting.md | 1 - images/docker-stacks-foundation/Dockerfile | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/using/selecting.md b/docs/using/selecting.md index 44a1681718..97fb500801 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -32,7 +32,6 @@ It contains: - Package managers - [conda](https://github.com/conda/conda): "cross-platform, language-agnostic binary package manager". - [mamba](https://github.com/mamba-org/mamba): "reimplementation of the conda package manager in C++". We use this package manager by default when installing packages. - - [plumbum](https://github.com/tomerfiliba/plumbum): "small yet feature-rich library for shell script-like programs in Python". - Unprivileged user `jovyan` (`uid=1000`, configurable, [see options in the common features section](./common.md) of this documentation) in group `users` (`gid=100`) with ownership over the `/home/jovyan` and `/opt/conda` paths - `tini` as the container entry point diff --git a/images/docker-stacks-foundation/Dockerfile b/images/docker-stacks-foundation/Dockerfile index 48dea4204d..34a3077e33 100644 --- a/images/docker-stacks-foundation/Dockerfile +++ b/images/docker-stacks-foundation/Dockerfile @@ -89,7 +89,7 @@ RUN mkdir "/home/${NB_USER}/work" && \ # Similar projects using Micromamba: # - Micromamba-Docker: # - repo2docker: -# Install Python, Mamba, jupyter_core, and plumbum +# Install Python, Mamba, and jupyter_core # Cleanup temporary files and remove Micromamba # Correct permissions # Do all this in a single RUN command to avoid duplicating all of the @@ -115,8 +115,7 @@ RUN set -x && \ --yes \ "${PYTHON_SPECIFIER}" \ 'mamba' \ - 'jupyter_core' \ - 'plumbum' && \ + 'jupyter_core' && \ 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" && \ From f1db469129028184f8e3bb9c314354cfd1f2844f Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Dec 2023 21:29:44 +0100 Subject: [PATCH 12/15] Remove jq from the image --- docs/using/selecting.md | 1 - images/minimal-notebook/Dockerfile | 1 - 2 files changed, 2 deletions(-) diff --git a/docs/using/selecting.md b/docs/using/selecting.md index 97fb500801..2739930374 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -81,7 +81,6 @@ It contains: - Common useful utilities like [curl](https://curl.se), [git](https://git-scm.com/), - [jq](https://jqlang.github.io/jq/), [nano](https://www.nano-editor.org/) (actually `nano-tiny`), [tzdata](https://www.iana.org/time-zones), [unzip](https://code.launchpad.net/ubuntu/+source/unzip), diff --git a/images/minimal-notebook/Dockerfile b/images/minimal-notebook/Dockerfile index eb28f58801..a0dbfc65c6 100644 --- a/images/minimal-notebook/Dockerfile +++ b/images/minimal-notebook/Dockerfile @@ -19,7 +19,6 @@ RUN apt-get update --yes && \ # Common useful utilities curl \ git \ - jq \ nano-tiny \ tzdata \ unzip \ From ad54a652c47d61e6f25f54a6f2d18ab8556c4fc6 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Dec 2023 21:30:03 +0100 Subject: [PATCH 13/15] Remove setup-julia.bash file --- .../setup-scripts/setup-julia.bash | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100755 images/minimal-notebook/setup-scripts/setup-julia.bash diff --git a/images/minimal-notebook/setup-scripts/setup-julia.bash b/images/minimal-notebook/setup-scripts/setup-julia.bash deleted file mode 100755 index 7fa7fe596c..0000000000 --- a/images/minimal-notebook/setup-scripts/setup-julia.bash +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -exuo pipefail -# Requirements: -# - Run as the root user -# - The JULIA_PKGDIR environment variable is set - -# Get the last stable version of Julia -# https://github.com/JuliaLang/www.julialang.org/issues/878#issuecomment-749234813 - -JULIA_LATEST_INFO=$( - wget -O - -o /dev/null 'https://julialang-s3.julialang.org/bin/versions.json' | - jq ' - with_entries(select(.value.stable==true)) | - to_entries | - max_by(.key).value.files | - .[] - ' | - jq "select(.triplet == \"$(uname -m)-linux-gnu\")" -) -JULIA_INSTALLER_URL=$(echo "${JULIA_LATEST_INFO}" | jq --raw-output ".url") -JULIA_VERSION=$(echo "${JULIA_LATEST_INFO}" | jq --raw-output ".version") - -# Download and install Julia -mkdir "/opt/julia-${JULIA_VERSION}" -curl --progress-bar --location --output /tmp/julia.tar.gz "${JULIA_INSTALLER_URL}" -tar xzf /tmp/julia.tar.gz -C "/opt/julia-${JULIA_VERSION}" --strip-components=1 -rm /tmp/julia.tar.gz - -# Link Julia installed version to /usr/local/bin, so julia launches it -ln -fs /opt/julia-*/bin/julia /usr/local/bin/julia - -# Tell Julia where conda libraries are -mkdir -p /etc/julia -echo "push!(Libdl.DL_LOAD_PATH, \"${CONDA_DIR}/lib\")" >> /etc/julia/juliarc.jl - -# Create JULIA_PKGDIR, where user libraries are installed -mkdir "${JULIA_PKGDIR}" -chown "${NB_USER}" "${JULIA_PKGDIR}" -fix-permissions "${JULIA_PKGDIR}" From 1a926bef208ef9bdc49fe7afaab9a92442ece57c Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Dec 2023 21:34:04 +0100 Subject: [PATCH 14/15] Fix file name --- images/minimal-notebook/setup-scripts/setup_julia.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/minimal-notebook/setup-scripts/setup_julia.py b/images/minimal-notebook/setup-scripts/setup_julia.py index 62909f5328..851a66132c 100755 --- a/images/minimal-notebook/setup-scripts/setup_julia.py +++ b/images/minimal-notebook/setup-scripts/setup_julia.py @@ -73,7 +73,7 @@ def prepare_julia(julia_version: str) -> None: JULIA_PKGDIR = Path(os.environ["JULIA_PKGDIR"]) JULIA_PKGDIR.mkdir() subprocess.check_call(["chown", os.environ["NB_USER"], JULIA_PKGDIR]) - subprocess.check_call(["fix_permissions", JULIA_PKGDIR]) + subprocess.check_call(["fix-permissions", JULIA_PKGDIR]) if __name__ == "__main__": From d9c91c5201ad0bbb758aa5cb41001530a40f0ff1 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Dec 2023 21:40:34 +0100 Subject: [PATCH 15/15] Fix docstring --- images/minimal-notebook/setup-scripts/setup_julia.py | 5 ++++- tagging/get_platform.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/images/minimal-notebook/setup-scripts/setup_julia.py b/images/minimal-notebook/setup-scripts/setup_julia.py index 851a66132c..0cdbe0cfa2 100755 --- a/images/minimal-notebook/setup-scripts/setup_julia.py +++ b/images/minimal-notebook/setup-scripts/setup_julia.py @@ -16,9 +16,12 @@ def unify_aarch64(platform: str) -> str: + """ + Renames arm64->aarch64 to support local builds on on aarch64 Macs + """ return { "aarch64": "aarch64", - "arm64": "aarch64", # To support local building on aarch64 Macs + "arm64": "aarch64", "x86_64": "x86_64", }[platform] diff --git a/tagging/get_platform.py b/tagging/get_platform.py index 187a259262..cda791ab7d 100644 --- a/tagging/get_platform.py +++ b/tagging/get_platform.py @@ -6,9 +6,12 @@ def unify_aarch64(platform: str) -> str: + """ + Renames arm64->aarch64 to support local builds on on aarch64 Macs + """ return { "aarch64": "aarch64", - "arm64": "aarch64", # To support local building on aarch64 Macs + "arm64": "aarch64", "x86_64": "x86_64", }[platform]