Skip to content
Snippets Groups Projects
Verified Commit 13eb6fe5 authored by Olivier Benz's avatar Olivier Benz
Browse files

CUDA images: Correct image license

- Sync startup scripts with jupyter/docker-stacks
parent 5fd279f8
No related branches found
No related tags found
No related merge requests found
......@@ -2,14 +2,14 @@
Topmost entry = Tag `latest`
| R | SAGA[^2] | CUDA | cuBLAS | cuDNN | NCCL | TensorRT | Linux distro |
| R | SAGA[^1] | CUDA | cuBLAS | cuDNN | NCCL | TensorRT | Linux distro |
|:------|:---------|:-------|:----------|:------|:-------|:----------|:-------------|
| 4.3.3 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.6 | 2.15.5 | 8.5.3[^1] | Ubuntu 22.04 |
| 4.3.2 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.6 | 2.15.5 | 8.5.3[^1] | Ubuntu 22.04 |
| 4.3.1 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.0 | 2.15.5 | 8.5.3[^1] | Ubuntu 22.04 |
| 4.3.0 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.0 | 2.15.5 | 8.5.3[^1] | Ubuntu 22.04 |
| 4.2.3 | n/a | 11.8.0 | 11.11.3.6 | 8.7.0 | 2.15.5 | 8.5.3[^1] | Ubuntu 22.04 |
| 4.3.3 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.6 | 2.15.5 | 8.5.3[^2] | Ubuntu 22.04 |
| 4.3.2 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.6 | 2.15.5 | 8.5.3[^2] | Ubuntu 22.04 |
| 4.3.1 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.0 | 2.15.5 | 8.5.3[^2] | Ubuntu 22.04 |
| 4.3.0 | 7.3.0 | 11.8.0 | 11.11.3.6 | 8.9.0 | 2.15.5 | 8.5.3[^2] | Ubuntu 22.04 |
| 4.2.3 | n/a | 11.8.0 | 11.11.3.6 | 8.7.0 | 2.15.5 | 8.5.3[^2] | Ubuntu 22.04 |
| 4.2.2 | n/a | 11.8.0 | 11.11.3.6 | 8.7.0 | 2.16.2 | 8.5.3 | Ubuntu 20.04 |
[^1]: `amd64` only
[^2]: qgisprocess image
[^1]: qgisprocess image
[^2]: `amd64` only
......@@ -15,5 +15,5 @@ Topmost entry = Tag `latest`
[^1]: R version ≥ 4.3.1
[^2]: verse+ images
[^3]: qgisprocess image
[^4]: `amd64` only; QGIS v3.36.0 w/o OTB provider
[^3]: qgisprocess image; QGIS v3.36.0 w/o OTB provider
[^4]: `amd64` only
......@@ -68,6 +68,7 @@ build:latest-linux-amd64:
--build-arg BUILD_ON_IMAGE
--build-arg R_VERSION
--build-arg CUDA_IMAGE_FLAVOR
--build-arg CUDA_IMAGE_LICENSE
--build-arg NCPUS=$((`nproc`/2+1))
--build-arg BUILD_START=$(date -uIseconds)
-t $CI_APP_REPO:$CI_APP_TAG-linux-amd64
......@@ -114,6 +115,7 @@ build:latest-linux-arm64v8:
--build-arg BUILD_ON_IMAGE
--build-arg R_VERSION
--build-arg CUDA_IMAGE_FLAVOR
--build-arg CUDA_IMAGE_LICENSE
--build-arg NCPUS=$((`nproc`/2+1))
--build-arg BUILD_START=$(date -uIseconds)
-t $CI_APP_REPO:$CI_APP_TAG-linux-arm64v8
......@@ -159,6 +161,7 @@ build:version-linux-amd64:
--build-arg BASE_IMAGE_TAG
--build-arg BUILD_ON_IMAGE
--build-arg CUDA_IMAGE_FLAVOR
--build-arg CUDA_IMAGE_LICENSE
--build-arg NCPUS=$((`nproc`/2+1))
--build-arg BUILD_START=$(date -uIseconds)
-t $CI_APP_REPO:$CI_APP_TAG-linux-amd64
......@@ -200,6 +203,7 @@ build:version-linux-arm64v8:
--build-arg BASE_IMAGE_TAG
--build-arg BUILD_ON_IMAGE
--build-arg CUDA_IMAGE_FLAVOR
--build-arg CUDA_IMAGE_LICENSE
--build-arg NCPUS=$((`nproc`/2+1))
--build-arg BUILD_START=$(date -uIseconds)
-t $CI_APP_REPO:$CI_APP_TAG-linux-arm64v8
......
#!/bin/bash
# Copyright (c) 2023 b-data GmbH.
# Distributed under the terms of the MIT License.
set -e
scripts="start-notebook.sh start-singleuser.sh"
for i in $scripts ; do
curl -sSL https://raw.githubusercontent.com/jupyter/docker-stacks/main/images/base-notebook/"$i" \
-o scripts/usr/local/bin/"$i"
done
scripts="start.sh run-hooks.sh"
for i in $scripts ; do
curl -sSL https://raw.githubusercontent.com/jupyter/docker-stacks/main/images/docker-stacks-foundation/"$i" \
-o scripts/usr/local/bin/"$i"
done
chmod +x scripts/usr/local/bin/*.sh
......@@ -29,6 +29,7 @@ COPY conf/shell /files
COPY conf/user /files
COPY scripts /files
## Copy content of skel directory to backup
RUN cp -a /files/etc/skel/. /files/var/backups/skel \
&& chown -R ${NB_UID}:${NB_GID} /files/var/backups/skel \
## Copy custom fonts
......@@ -37,11 +38,18 @@ RUN cp -a /files/etc/skel/. /files/var/backups/skel \
/files/usr/local/share/jupyter/lab/static/assets \
&& cp -a /files/opt/code-server/src/browser/media/fonts \
/files/usr/local/share/jupyter/lab/static/assets \
## Use standard R terminal for CUDA images
## radian forces usage of /usr[/local]/bin/python
&& if [ ! -z "$CUDA_IMAGE" ]; then \
&& if [ -n "${CUDA_VERSION}" ]; then \
## Use standard R terminal for CUDA images
## radian forces usage of /usr[/local]/bin/python
sed -i 's|/usr/local/bin/radian|/usr/local/bin/R|g' \
/files/var/backups/skel/.local/share/code-server/User/settings.json; \
## Use entrypoint of CUDA image
mv /opt/nvidia/entrypoint.d /opt/nvidia/nvidia_entrypoint.sh \
/files/usr/local/bin; \
mv /files/usr/local/bin/start.sh \
/files/usr/local/bin/entrypoint.d/99-start.sh; \
mv /files/usr/local/bin/nvidia_entrypoint.sh \
/files/usr/local/bin/start.sh; \
fi \
## Ensure file modes are correct when using CI
## Otherwise set to 777 in the target image
......@@ -55,7 +63,10 @@ FROM glcr.b-data.ch/git-lfs/glfsi:${GIT_LFS_VERSION} AS glfsi
FROM ${BUILD_ON_IMAGE}:${R_VERSION}${CUDA_IMAGE_FLAVOR:+-}${CUDA_IMAGE_FLAVOR}
LABEL org.opencontainers.image.licenses="MIT" \
ARG CUDA_IMAGE_LICENSE
ARG IMAGE_LICENSE=${CUDA_IMAGE_LICENSE:-MIT}
LABEL org.opencontainers.image.licenses="$IMAGE_LICENSE" \
org.opencontainers.image.source="https://gitlab.b-data.ch/jupyterlab/r/docker-stack" \
org.opencontainers.image.vendor="b-data GmbH" \
org.opencontainers.image.authors="Olivier Benz <olivier.benz@b-data.ch>"
......
......@@ -10,14 +10,14 @@ if [ "$#" -ne 1 ]; then
return 1
fi
if [[ ! -d "${1}" ]] ; then
if [[ ! -d "${1}" ]]; then
echo "Directory ${1} doesn't exist or is not a directory"
return 1
fi
echo "Running hooks in: ${1} as uid: $(id -u) gid: $(id -g)"
for f in "${1}/"*; do
# Hadling a case when the directory is empty
# Handling a case when the directory is empty
[ -e "${f}" ] || continue
case "${f}" in
*.sh)
......@@ -25,16 +25,16 @@ for f in "${1}/"*; do
# shellcheck disable=SC1090
source "${f}"
# shellcheck disable=SC2181
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ]; then
echo "${f} has failed, continuing execution"
fi
;;
*)
if [ -x "${f}" ] ; then
if [ -x "${f}" ]; then
echo "Running executable: ${f}"
"${f}"
# shellcheck disable=SC2181
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ]; then
echo "${f} has failed, continuing execution"
fi
else
......
......@@ -4,13 +4,19 @@
set -e
if [ -n "${CUDA_IMAGE}" ]; then
echo
print_banner_text "=" "JUPYTER"
echo
fi
function run_user_group() {
runuser -u "${NB_USER}" -g "$(id -gn "${NB_USER}")" -G "users" -- "$@"
}
# The _log function is used for everything this script wants to log. It will
# always log errors and warnings, but can be silenced for other messages
# by setting JUPYTER_DOCKER_STACKS_QUIET environment variable.
# The _log function is used for everything this script wants to log.
# It will always log errors and warnings but can be silenced for other messages
# by setting the JUPYTER_DOCKER_STACKS_QUIET environment variable.
_log () {
if [[ "$*" == "ERROR:"* ]] || [[ "$*" == "WARNING:"* ]] || [[ "${JUPYTER_DOCKER_STACKS_QUIET}" == "" ]]; then
echo "$@"
......@@ -57,7 +63,7 @@ source /usr/local/bin/run-hooks.sh /usr/local/bin/start-notebook.d
# things before we run the command passed to start.sh as the desired user
# (NB_USER).
#
if [ "$(id -u)" == 0 ] ; then
if [ "$(id -u)" == 0 ]; then
# Environment variables:
# - NB_USER: the desired username and associated home folder
# - NB_UID: the desired user id
......@@ -65,20 +71,20 @@ if [ "$(id -u)" == 0 ] ; then
# - NB_GROUP: a group name we want for the group
# - GRANT_SUDO: a boolean ("1" or "yes") to grant the user sudo rights
# - CHOWN_HOME: a boolean ("1" or "yes") to chown the user's home folder
# - CHOWN_EXTRA: a comma separated list of paths to chown
# - CHOWN_EXTRA: a comma-separated list of paths to chown
# - CHOWN_HOME_OPTS / CHOWN_EXTRA_OPTS: arguments to the chown commands
# - CHMOD_HOME: a boolean ("1" or "yes") to chmod the user's home folder
# - CHMOD_HOME_MODE: mode argument to the chmod command
# Refit the jovyan user to the desired the user (NB_USER)
if id jovyan &> /dev/null ; then
if id jovyan &> /dev/null; then
if ! usermod --home "/home/${NB_USER}${DOMAIN:+@$DOMAIN}" --login "${NB_USER}" jovyan 2>&1 | grep "no changes" > /dev/null; then
_log "Updated the jovyan user:"
_log "- username: jovyan -> ${NB_USER}"
_log "- home dir: /home/jovyan -> /home/${NB_USER}${DOMAIN:+@$DOMAIN}"
fi
elif ! id -u "${NB_USER}" &> /dev/null; then
_log "ERROR: Neither the jovyan user or '${NB_USER}' exists. This could be the result of stopping and starting, the container with a different NB_USER environment variable."
_log "ERROR: Neither the jovyan user nor '${NB_USER}' exists. This could be the result of stopping and starting, the container with a different NB_USER environment variable."
exit 1
fi
......@@ -123,7 +129,7 @@ if [ "$(id -u)" == 0 ] ; then
# Note: Allows to run the container as root.
# Use case: Docker/Podman in rootless mode.
# Move or symlink the jovyan home directory to the desired users home
# Move or symlink the jovyan home directory to the desired user's home
# directory if it doesn't already exist, and update the current working
# directory to the new location if needed.
if [[ "${NB_USER}" != "jovyan" ]]; then
......@@ -220,7 +226,7 @@ if [ "$(id -u)" == 0 ] ; then
fi
# Optionally grant passwordless sudo rights for the desired user
if [[ "$GRANT_SUDO" == "1" || "$GRANT_SUDO" == "yes" ]]; then
if [[ "${GRANT_SUDO}" == "1" || "${GRANT_SUDO}" == "yes" ]]; then
_log "Granting ${NB_USER} passwordless sudo rights!"
echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/added-by-start-script
fi
......@@ -255,7 +261,7 @@ if [ "$(id -u)" == 0 ] ; then
# - We use the `--set-home` flag to set the HOME variable appropriately.
#
# - To reduce the default list of variables deleted by sudo, we could have
# used `env_delete` from /etc/sudoers. It has higher priority than the
# used `env_delete` from /etc/sudoers. It has a higher priority than the
# `--preserve-env` flag and the `env_keep` configuration.
#
# - We preserve LD_LIBRARY_PATH, PATH and PYTHONPATH explicitly. Note however that sudo
......@@ -278,7 +284,7 @@ else
# Attempt to ensure the user uid we currently run as has a named entry in
# the /etc/passwd file, as it avoids software crashing on hard assumptions
# on such entry. Writing to the /etc/passwd was allowed for the root group
# from the Dockerfile during build.
# from the Dockerfile during the build.
#
# ref: https://github.com/jupyter/docker-stacks/issues/552
if ! whoami &> /dev/null; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment