Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node notebooks #1

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Use bash for inline if-statements in target
SHELL:=bash
TAG:=julia-1.6.1
TAG:=latest
OWNER:=illumidesk
VENV_NAME?=venv
VENV_BIN=$(shell pwd)/${VENV_NAME}/bin
Expand All @@ -13,7 +13,10 @@ VENV_ACTIVATE=. ${VENV_BIN}/activate
PYTHON=${VENV_BIN}/python3

# Need to list the images in build dependency order
ALL_STACKS:=umich-notebook
ALL_STACKS:=:= \
python-notebook \
deno-notebook \
node-notebook

ALL_IMAGES:=$(ALL_STACKS)

Expand Down
40 changes: 40 additions & 0 deletions deno-notebook/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Based mostly off of:
# https://github.com/jupyter/docker-stacks/blob/main/images/julia-notebook
ARG REGISTRY=quay.io
ARG OWNER=jupyter
ARG BASE_CONTAINER=$REGISTRY/$OWNER/minimal-notebook
FROM $BASE_CONTAINER

ENV NB_UID=1000
ENV 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 "${NB_USER}"

# Install Jupyter Console and Kernel Gateway
RUN pip install jupyter-console jupyter_kernel_gateway

# Install deno
RUN curl -fsSL https://deno.land/x/install/install.sh | sh \
&& "${HOME}/.deno/bin/deno" jupyter --unstable --install \
&& mv "${HOME}/.deno/bin/deno" "${CONDA_DIR}/bin" \
&& rm -Rf "${HOME}/.deno/bin/deno"

RUN rm -Rf "${HOME}/.local/share/jupyter/kernels/deno" \
&& mkdir -p "${CONDA_DIR}/share/jupyter/kernels/deno"
COPY --chown=${NB_UID}:${NB_GID} "setup-scripts/kernel-deno.json" "${CONDA_DIR}/share/jupyter/kernels/deno/kernel.json"

# update permissions as root
USER root
RUN fix-permissions /etc/jupyter/ \
&& fix-permissions "${CONDA_DIR}" \
&& fix-permissions "${HOME}"

USER "${NB_USER}"

WORKDIR "${HOME}"

CMD ["jupyter", "kernelgateway", "--KernelGatewayApp.ip=0.0.0.0", "--KernelGatewayApp.port=8888"]
12 changes: 12 additions & 0 deletions deno-notebook/setup-scripts/kernel-deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"argv": [
"deno",
"--unstable-ffi",
"jupyter",
"--kernel",
"--conn",
"{connection_file}"
],
"display_name": "Deno",
"language": "typescript"
}
42 changes: 42 additions & 0 deletions node-notebook/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Based mostly off of:
# https://github.com/jupyter/docker-stacks/blob/main/images/julia-notebook
ARG REGISTRY=quay.io
ARG OWNER=jupyter
ARG BASE_CONTAINER=$REGISTRY/$OWNER/minimal-notebook
FROM $BASE_CONTAINER

ENV NB_UID=1000
ENV 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 "${NB_USER}"

# Install Jupyter Console and Kernel Gateway
RUN pip install jupyter-console jupyter_kernel_gateway

# Install tslab
ENV PATH "$PATH:${CONDA_DIR}/.npm-global/bin"
RUN mkdir "${CONDA_DIR}/.npm-global" \
&& npm config set prefix "${CONDA_DIR}/.npm-global" \
&& npm install -g tslab \
&& tslab install \
&& rm -Rf "${HOME}/.npm-global/bin/tslab"

RUN rm -Rf "${HOME}/.local/share/jupyter/kernels/tslab" \
&& mkdir -p "${CONDA_DIR}/share/jupyter/kernels/tslab"
COPY --chown=${NB_UID}:${NB_GID} "setup-scripts/kernel-tslab.json" "${CONDA_DIR}/share/jupyter/kernels/tslab/kernel.json"

# update permissions as root
USER root
RUN fix-permissions /etc/jupyter/ \
&& fix-permissions "${CONDA_DIR}" \
&& fix-permissions "${HOME}"

USER "${NB_USER}"

WORKDIR "${HOME}"

CMD ["jupyter", "kernelgateway", "--KernelGatewayApp.ip=0.0.0.0", "--KernelGatewayApp.port=8888"]
1 change: 1 addition & 0 deletions node-notebook/setup-scripts/kernel-tslab.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"argv": ["tslab", "kernel", "--config-path", "{connection_file}"], "display_name": "Node (TypeScript)", "language": "typescript"}
34 changes: 27 additions & 7 deletions python-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,40 @@
# https://github.com/jupyter/docker-stacks/blob/main/images/julia-notebook
ARG REGISTRY=quay.io
ARG OWNER=jupyter
ARG BASE_CONTAINER=$REGISTRY/$OWNER/datascience-notebook
FROM ${BASE_CONTAINER}
ARG BASE_CONTAINER=$REGISTRY/$OWNER/minimal-notebook
FROM $BASE_CONTAINER

ENV NB_UID=1000
ENV 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 ${NB_UID}
USER "${NB_USER}"

# Setup IJulia kernel & other packages
COPY --chown=${NB_UID}:${NB_GID} requirements.txt "${HOME}/requirements.txt"
WORKDIR "${HOME}"
RUN pip install -r requirements.txt
# Install Jupyter Console and Kernel Gateway
RUN pip install jupyter-console jupyter_kernel_gateway

# Install tslab
ENV PATH "$PATH:${CONDA_DIR}/.npm-global/bin"
RUN mkdir "${CONDA_DIR}/.npm-global" \
&& npm config set prefix "${CONDA_DIR}/.npm-global" \
&& npm install -g tslab \
&& tslab install \
&& rm -Rf "${HOME}/.npm-global/bin/tslab"

RUN rm -Rf "${HOME}/.local/share/jupyter/kernels/tslab" \
&& mkdir -p "${CONDA_DIR}/share/jupyter/kernels/tslab"
COPY --chown=${NB_UID}:${NB_GID} "setup-scripts/kernel-tslab.json" "${CONDA_DIR}/share/jupyter/kernels/tslab/kernel.json"

# update permissions as root
USER root
RUN fix-permissions /etc/jupyter/ \
&& fix-permissions "${CONDA_DIR}" \
&& fix-permissions "${HOME}"

USER "${NB_USER}"

WORKDIR "${HOME}"

Expand Down
1 change: 1 addition & 0 deletions python-notebook/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
duckduckgo-search
psycopg2-binary
gpt4all
jupyter_kernel_gateway
Expand Down
Loading