-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (JupyterHub): Changed base image to a simpler one.
- Loading branch information
1 parent
25d980b
commit 296518b
Showing
5 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
on: | ||
push: | ||
paths: | ||
- jupyterhub/base-gpu/**/* | ||
- .github/workflows/jupyterhub-base-gpu.yml | ||
- .github/workflows/builder.yml | ||
branches: | ||
- "master" | ||
- "main" | ||
- "latest" | ||
release: | ||
types: | ||
- created | ||
jobs: | ||
build-jupyterhub-base-gpu: | ||
uses: ./.github/workflows/builder.yml | ||
with: | ||
context: jupyterhub/base-gpu | ||
dockerfile: jupyterhub/base-gpu/Dockerfile | ||
name: ertis-research/jupyterhub-base-gpu | ||
platforms: linux/amd64 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
USER root | ||
|
||
# Install some basic utilities and python3.10 | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
curl \ | ||
ca-certificates \ | ||
sudo \ | ||
git \ | ||
bzip2 \ | ||
tzdata \ | ||
less \ | ||
xclip \ | ||
libx11-6 \ | ||
nano \ | ||
bat \ | ||
locales \ | ||
sudo \ | ||
openssh-client \ | ||
iputils-ping \ | ||
gpg \ | ||
tini \ | ||
wget \ | ||
&& \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* && \ | ||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ | ||
locale-gen | ||
|
||
# Install EZA | ||
RUN mkdir -p /etc/apt/keyrings && \ | ||
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg && \ | ||
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list && \ | ||
chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list && \ | ||
apt update -y && \ | ||
apt install -y eza \ | ||
&& \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# alias ls with eza | ||
RUN echo "alias ls='eza'" >> ~/.bashrc | ||
RUN echo "alias cat='batcat'" >> ~/.bashrc | ||
|
||
|
||
# Install Python 3.10 | ||
RUN apt-get update --yes && \ | ||
apt-get install --yes --no-install-recommends \ | ||
python3.10 \ | ||
python3-pip \ | ||
python3.10-dev \ | ||
python3.10-distutils \ | ||
&& \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY jupyter_requirements.txt /tmp/jupyter_requirements.txt | ||
|
||
RUN pip install --no-cache-dir -r /tmp/jupyter_requirements.txt | ||
|
||
# Initialization of user copied from: | ||
# https://github.com/jupyter/docker-stacks/blob/main/docker-stacks-foundation/Dockerfile | ||
|
||
ARG NB_USER="ertis" | ||
ARG NB_UID="1000" | ||
ARG NB_GID="100" | ||
|
||
# Fix: https://github.com/hadolint/hadolint/wiki/DL4006 | ||
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014 | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
USER root | ||
|
||
COPY fix-permissions /usr/local/bin/fix-permissions | ||
RUN chmod a+rx /usr/local/bin/fix-permissions | ||
|
||
ENV HOME="/home/${NB_USER}" | ||
|
||
# Enable prompt color in the skeleton .bashrc before creating the default NB_USER | ||
# hadolint ignore=SC2016 | ||
RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc | ||
|
||
# Create NB_USER with name jovyan user with UID=1000 and in the 'users' group | ||
# and make sure these dirs are writable by the `users` group. | ||
RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \ | ||
useradd -l -m -s /bin/bash -N -u "${NB_UID}" "${NB_USER}" && \ | ||
chmod g+w /etc/passwd && \ | ||
fix-permissions "${HOME}" | ||
|
||
USER ${NB_UID} | ||
|
||
WORKDIR "${HOME}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Base GPU Jupyter notebook image for Jupyter hub | ||
|
||
Based on the [Jupyter Docker Stacks](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html) project and [Zonca's JupyterHub JetStream Deploy](https://github.com/zonca/jupyterhub-deploy-kubernetes-jetstream/blob/master/gpu/nvidia-tensorflow-jupyterhub/fix-permissions) | ||
|
||
Please visit the project documentation site for help to use and contribute to this image and others. | ||
|
||
- [Jupyter Docker Stacks on ReadTheDocs](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html) | ||
- [Selecting an Image :: Core Stacks :: jupyter/docker-stacks-foundation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-docker-stacks-foundation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# set permissions on a directory | ||
# after any installation, if a directory needs to be (human) user-writable, | ||
# run this script on it. | ||
# It will make everything in the directory owned by the group ${NB_GID} | ||
# and writable by that group. | ||
# Deployments that want to set a specific user id can preserve permissions | ||
# by adding the `--group-add users` line to `docker run`. | ||
|
||
# uses find to avoid touching files that already have the right permissions, | ||
# which would cause massive image explosion | ||
|
||
# right permissions are: | ||
# group=${NB_GID} | ||
# AND permissions include group rwX (directory-execute) | ||
# AND directories have setuid,setgid bits set | ||
|
||
set -e | ||
|
||
for d in "$@"; do | ||
find "${d}" \ | ||
! \( \ | ||
-group "${NB_GID}" \ | ||
-a -perm -g+rwX \ | ||
\) \ | ||
-exec chgrp "${NB_GID}" -- {} \+ \ | ||
-exec chmod g+rwX -- {} \+ | ||
# setuid, setgid *on directories only* | ||
find "${d}" \ | ||
\( \ | ||
-type d \ | ||
-a ! -perm -6000 \ | ||
\) \ | ||
-exec chmod +6000 -- {} \+ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
jupyterhub==4.0.2 | ||
jupyterlab==4.0.8 | ||
notebook==7.0.6 | ||
jupyter_server==2.10.1 |