Skip to content

Commit

Permalink
feat!: Created images for py3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniochavesgarcia committed Oct 25, 2024
1 parent 1755831 commit 3f5a511
Show file tree
Hide file tree
Showing 26 changed files with 508 additions and 366 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/jupyterhub-base-cuda12.2-cudnn8-py3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
paths:
- jupyterhub/base-cuda12.2-cudnn8-py3.9/**/*
- .github/workflows/jupyterhub-base-cuda12.2-cudnn8-py3.9.yml
- .github/workflows/builder.yml
branches:
- "master"
- "main"
- "latest"
release:
types:
- created
jobs:
build-jupyterhub-base-cuda122-cudnn8-py311:
uses: ./.github/workflows/builder.yml
with:
context: jupyterhub/base-cuda12.2-cudnn8-py3.9
dockerfile: jupyterhub/base-cuda12.2-cudnn8-py3.9/Dockerfile
name: ertis-research/jupyterhub-base-cuda12.2-cudnn8-py3.9
platforms: linux/amd64

22 changes: 22 additions & 0 deletions .github/workflows/jupyterhub-base-py3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
paths:
- jupyterhub/base-py3.9/**/*
- .github/workflows/jupyterhub-base-py3.9.yml
- .github/workflows/builder.yml
branches:
- "master"
- "main"
- "latest"
release:
types:
- created
jobs:
build-jupyterhub-base-py311:
uses: ./.github/workflows/builder.yml
with:
context: jupyterhub/base-py3.9
dockerfile: jupyterhub/base-py3.9/Dockerfile
name: ertis-research/jupyterhub-base-py3.9
platforms: linux/amd64

22 changes: 22 additions & 0 deletions .github/workflows/jupyterhub-pth-cuda12.2-cudnn8-py3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
paths:
- jupyterhub/pth-cuda12.2-cudnn8-py3.9/**/*
- .github/workflows/jupyterhub-pth-cuda12.2-cudnn8-py3.9.yml
- .github/workflows/builder.yml
branches:
- "master"
- "main"
- "latest"
release:
types:
- created
jobs:
build-jupyterhub-pth-cuda122-cudnn8-py311:
uses: ./.github/workflows/builder.yml
with:
context: jupyterhub/pth-cuda12.2-cudnn8-py3.9
dockerfile: jupyterhub/pth-cuda12.2-cudnn8-py3.9/Dockerfile
name: ertis-research/jupyterhub-pth-cuda12.2-cudnn8-py3.9
platforms: linux/amd64

22 changes: 22 additions & 0 deletions .github/workflows/jupyterhub-tf-cuda12.2-cudnn8-py3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
paths:
- jupyterhub/tf-cuda12.2-cudnn8-py3.9/**/*
- .github/workflows/jupyterhub-tf-cuda12.2-cudnn8-py3.9.yml
- .github/workflows/builder.yml
branches:
- "master"
- "main"
- "latest"
release:
types:
- created
jobs:
build-jupyterhub-tf-cuda122-cudnn8-py311:
uses: ./.github/workflows/builder.yml
with:
context: jupyterhub/tf-cuda12.2-cudnn8-py3.9
dockerfile: jupyterhub/tf-cuda12.2-cudnn8-py3.9/Dockerfile
name: ertis-research/jupyterhub-tf-cuda12.2-cudnn8-py3.9
platforms: linux/amd64

6 changes: 3 additions & 3 deletions jupyterhub/base-cuda12.2-cudnn8-py3.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG DEBIAN_FRONTEND=noninteractive

USER root

# Install some basic utilities and python3.10
# Install some basic utilities and python3.11
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
Expand All @@ -28,7 +28,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
dnsutils \
zip \
unzip \
python3.10-venv \
python3.11-venv \
htop \
atop \
jq \
Expand All @@ -49,7 +49,7 @@ RUN mkdir -p /etc/apt/keyrings && \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Python 3.10
# Install Python 3.11
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
python3.11 \
Expand Down
118 changes: 118 additions & 0 deletions jupyterhub/base-cuda12.2-cudnn8-py3.9/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# syntax=docker/dockerfile:1.3-labs

FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04

ARG DEBIAN_FRONTEND=noninteractive

USER root

# Install some basic utilities and python3.9
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 \
iputils-ping \
gpg \
tini \
wget \
dnsutils \
zip \
unzip \
python3.9-venv \
htop \
atop \
jq \
zsh \
sed \
&& \
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/*

# Install Python 3.9
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
python3.9 \
python3-pip \
python3.9-dev \
python3.9-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/zsh", "-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}"

# RUN chsh -s /bin/zsh

RUN sed -i 's/auth\s*sufficient\s*pam_shells.so/auth\s*required\s*pam_shells.so/g' /etc/pam.d/chsh
# Additional line to modify pam_rootok.so (usually not needed)
# RUN sed -i 's/auth\s*sufficient\s*pam_rootok.so/auth\s*required\s*pam_rootok.so/g' /etc/pam.d/chsh

USER ${NB_UID}

RUN chsh -s /bin/zsh

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN <<EOF
echo "alias ls='eza'" >> ~/.bashrc
echo "alias cat='batcat'" >> ~/.bashrc
EOF


RUN <<EOF
echo "alias ls='eza'" >> ~/.zshrc
echo "alias cat='batcat'" >> ~/.zshrc
EOF

WORKDIR "${HOME}"
8 changes: 8 additions & 0 deletions jupyterhub/base-cuda12.2-cudnn8-py3.9/README.md
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)
35 changes: 35 additions & 0 deletions jupyterhub/base-cuda12.2-cudnn8-py3.9/fix-permissions
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
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
6 changes: 1 addition & 5 deletions jupyterhub/base-py3.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,10 @@ RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \

# RUN chsh -s /bin/zsh

RUN sed -i 's/auth\s*sufficient\s*pam_shells.so/auth\s*required\s*pam_shells.so/g' /etc/pam.d/chsh
# Additional line to modify pam_rootok.so (usually not needed)
# RUN sed -i 's/auth\s*sufficient\s*pam_rootok.so/auth\s*required\s*pam_rootok.so/g' /etc/pam.d/chsh
RUN chsh -s /bin/zsh ${NB_UID}

USER ${NB_UID}

RUN chsh -s /bin/zsh

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN <<EOF
Expand Down
Loading

0 comments on commit 3f5a511

Please sign in to comment.