-
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): New Dockerfile build.
- Loading branch information
1 parent
e64d416
commit 137e8d3
Showing
5 changed files
with
56 additions
and
393 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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
# Base image: https://github.com/jupyter/docker-stacks/blob/74bbd0bffc3b444e2d65279739bc2d681b6199e2/images/docker-stacks-foundation/Dockerfile | ||
|
||
ARG ROOT_CONTAINER=tensorflow/tensorflow:2.14.0-gpu | ||
|
||
ARG FOUNDATION_CONTAINER=quay.io/jupyter/docker-stacks-foundation:4d70cf8da953 | ||
ARG BASE_NOTEBOOK=quay.io/jupyter/base-notebook:b86753318aa1 | ||
ARG MIN_NOTEBOOK | ||
|
||
FROM ${FOUNDATION_CONTAINER} as foundation | ||
FROM ${BASE_NOTEBOOK} as base_notebook | ||
|
||
|
||
FROM $ROOT_CONTAINER | ||
|
||
LABEL maintainer="Antonio J. Chaves <[email protected]>" | ||
|
@@ -12,27 +18,58 @@ ARG NB_USER="ertis" | |
ARG NB_UID="1000" | ||
ARG NB_GID="100" | ||
|
||
# Configure environment | ||
ENV CONDA_DIR=/opt/conda \ | ||
SHELL=/bin/bash \ | ||
NB_USER="${NB_USER}" \ | ||
NB_UID=${NB_UID} \ | ||
NB_GID=${NB_GID} \ | ||
LC_ALL=en_US.UTF-8 \ | ||
LANG=en_US.UTF-8 \ | ||
LANGUAGE=en_US.UTF-8 | ||
ENV PATH="${CONDA_DIR}/bin:${PATH}" \ | ||
HOME="/home/${NB_USER}" | ||
|
||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
USER root | ||
|
||
COPY --from=foundation /usr/local/bin/fix-permissions /usr/local/bin/ | ||
COPY --from=foundation --chown="${NB_UID}:${NB_GID}" "${CONDA_DIR}/.condarc/initial-condarc" "${CONDA_DIR}/.condarc/" | ||
COPY --from=foundation /usr/local/bin/run-hooks.sh /usr/local/bin/ | ||
COPY --from=foundation /usr/local/bin/start.sh /usr/local/bin/ | ||
|
||
COPY --from=base_notebook /usr/local/bin/start-notebook.sh /usr/local/bin/ | ||
COPY --from=base_notebook /usr/local/bin/start-singleuser.sh /usr/local/bin/ | ||
COPY --from=base_notebook /etc/jupyter/jupyter_server_config.py /etc/jupyter/ | ||
|
||
|
||
COPY --from=base_notebook /etc/jupyter/docker_healthcheck.py /etc/jupyter/ | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN apt-get update --yes && \ | ||
apt-get upgrade --yes && \ | ||
apt-get install --yes --no-install-recommends \ | ||
bzip2 \ | ||
curl \ | ||
git \ | ||
tzdata \ | ||
openssh-client \ | ||
less \ | ||
texlive-xetex \ | ||
texlive-fonts-recommended \ | ||
texlive-plain-generic \ | ||
xclip \ | ||
git \ | ||
nano \ | ||
bat \ | ||
fonts-liberation \ | ||
pandoc \ | ||
run-one && \ | ||
iputils-ping \ | ||
ca-certificates \ | ||
locales \ | ||
sudo \ | ||
iputils-ping \ | ||
gpg \ | ||
tini \ | ||
wget && \ | ||
|
@@ -41,20 +78,14 @@ RUN apt-get update --yes && \ | |
locale-gen | ||
|
||
|
||
# Configure environment | ||
ENV CONDA_DIR=/opt/conda \ | ||
SHELL=/bin/bash \ | ||
NB_USER="${NB_USER}" \ | ||
NB_UID=${NB_UID} \ | ||
NB_GID=${NB_GID} \ | ||
LC_ALL=en_US.UTF-8 \ | ||
LANG=en_US.UTF-8 \ | ||
LANGUAGE=en_US.UTF-8 | ||
ENV PATH="${CONDA_DIR}/bin:${PATH}" \ | ||
HOME="/home/${NB_USER}" | ||
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 | ||
|
||
# Copy a script that we will use to correct permissions after running certain commands | ||
COPY fix-permissions /usr/local/bin/fix-permissions | ||
RUN chmod a+rx /usr/local/bin/fix-permissions | ||
|
||
# Enable prompt color in the skeleton .bashrc before creating the default NB_USER | ||
|
@@ -125,59 +156,14 @@ RUN set -x && \ | |
|
||
# Configure container startup | ||
ENTRYPOINT ["tini", "-g", "--"] | ||
CMD ["start.sh"] | ||
|
||
# Copy local files as late as possible to avoid cache busting | ||
COPY run-hooks.sh start.sh /usr/local/bin/ | ||
# CMD ["start.sh"] | ||
|
||
USER root | ||
|
||
# Create dirs for startup hooks | ||
RUN mkdir /usr/local/bin/start-notebook.d && \ | ||
mkdir /usr/local/bin/before-notebook.d | ||
|
||
|
||
RUN apt-get update --yes && \ | ||
apt-get upgrade --yes && \ | ||
apt-get install --yes --no-install-recommends \ | ||
bzip2 \ | ||
curl \ | ||
tzdata \ | ||
unzip \ | ||
vim-tiny \ | ||
openssh-client \ | ||
less \ | ||
texlive-xetex \ | ||
texlive-fonts-recommended \ | ||
texlive-plain-generic \ | ||
xclip \ | ||
git \ | ||
nano \ | ||
bat \ | ||
ca-certificates \ | ||
locales \ | ||
sudo \ | ||
iputils-ping \ | ||
gpg \ | ||
tini \ | ||
fonts-liberation \ | ||
# - pandoc is used to convert notebooks to html files | ||
# it's not present in aarch64 ubuntu image, so we install it here | ||
pandoc \ | ||
# - run-one - a wrapper script that runs no more | ||
# than one unique instance of some command with a unique set of arguments, | ||
# we use `run-one-constantly` to support `RESTARTABLE` option | ||
run-one && \ | ||
wget && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
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 | ||
|
||
USER ${NB_UID} | ||
|
||
# Install JupyterLab, Jupyter Notebook, JupyterHub and NBClassic | ||
|
@@ -206,13 +192,17 @@ EXPOSE $JUPYTER_PORT | |
# Configure container startup | ||
CMD ["start-notebook.sh"] | ||
|
||
# Copy local files as late as possible to avoid cache busting | ||
COPY start-notebook.sh start-singleuser.sh /usr/local/bin/ | ||
COPY jupyter_server_config.py docker_healthcheck.py /etc/jupyter/ | ||
# Fix permissions on /etc/jupyter as root | ||
USER root | ||
RUN fix-permissions /etc/jupyter/ | ||
|
||
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck | ||
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server` and `retro` jupyter commands | ||
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799 | ||
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \ | ||
CMD /etc/jupyter/docker_healthcheck.py || exit 1 | ||
|
||
# Switch back to jovyan to avoid accidental container runs as root | ||
USER ${NB_UID} | ||
|
||
WORKDIR "${HOME}" | ||
|
||
WORKDIR "${HOME}" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.