Skip to content

Commit 393d57a

Browse files
PeterSu92yuhuyoyo
andauthored
Parabricks jupyter (#229)
* initial commits for the nemo container custom app * adding Dockerfile using nvcr.io/nvidia/nemo:24.09 * putting the image directly in docker-compose.yaml * commented out the sudo command at the end * fixed syntax error with network spacing, set user to root * fixed more indentation errors * indentation fix not persisting? * removed initialize command, hardcoded /workspace as the post-startup.sh script, added java and google-cloud-cli as features to install * added the jupyter command back in * adding files for parabricks container, only differs from nemo in the image itself right now * modifying parabricks container to run command: tail -f /dev/null * adding a workbench-jupyter-parabricks directory * adding restart: always to the parabricks app * replacing wb with /usr/bin/wb to avoid conflicts with the weights&biases executable * Removing parabricks standalone * alias the weightsbiases in the postCreateCommand in the devcontainer for nemo_jupyter * removing erroneous wb replacement * replacing more instances of wb with /usr/bin/wb * replacing more instances of wb * replaced /usr/bin/wb with * added mappings back into .devcontainer.json * updating devcontainer-template id and description * adding quotes around all calls to {WORKBENCH_INSTALL_PATH} * updated some descriptions and IDs * using a Dockerfile that now starts from the parabricks container base image and installs Jupyter * updating postCreateCommand to match the nemo custom app * Adding mise and java features * updated Dockerfile to set the user as jupyter and set the home directory to /home/jupyter, use this new image in docker-compose.yaml * tried an approach that doesn't quite get it right, will revamp * updating Dockerfile to use jupyter user and set home to working directory, removed --allow-root from docker-compose.yaml * create group first, update docker-compose with the new image tag * using build context * adding local bin to path * removing some of the extraneous commands from the Dockerfile, switching back to the older java feature in the devcontainer * switching to the old java digest * use jupyter and /home/jupyter for the user and workspace, add sudo-passwordless.sh and call it in the devcontainer postCreateCommand * removing unused version of mise-java * updated Dockerfile per PR comments, adding sudo for all users and changing the shell to bash * removing unused mise, updated devcontainer template id * added missing mkdir command * using SHELL instruction to try and set bash as the default shell, cleaned up subsequent RUN command * still trying to update the Dockerfile to get the default shell within Jupyter to be bash * Reconfiguring order * removed sudo-passwordless.sh and corresponding call in postCreateCommand, adding aws-cli in as a feature * updating command to attempt removal of the bash -e not found error * adding parabricks to the test-pr detect-changes job * trying to just use ENV SHELL to set the shell terminal * changing escape sequences command --------- Co-authored-by: Yu Hu <[email protected]>
1 parent c0a3629 commit 393d57a

File tree

5 files changed

+157
-0
lines changed

5 files changed

+157
-0
lines changed

.github/workflows/test-pr.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ jobs:
5454
- './**/nemo_jupyter/**'
5555
- 'startupscript/**'
5656
- 'test/**'
57+
workbench-jupyter-parabricks:
58+
- './**/workbench-jupyter-parabricks/**'
59+
- 'startupscript/**'
60+
- 'test/**'
5761
5862
test:
5963
needs: [detect-changes]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "Workbench JupyterLab with docker support devcontainer template plus NVIDIA Parabricks",
3+
"dockerComposeFile": "docker-compose.yaml",
4+
"service": "app",
5+
"shutdownAction": "none",
6+
"workspaceFolder": "/workspace",
7+
// Get the host's docker group ID and propagate it into the .env file, which
8+
// allows it to be used within docker-compose.yaml.
9+
"initializeCommand": "DOCKER_GID=`getent group docker | cut -d: -f3` && echo \"DOCKER_GID=${DOCKER_GID}\" > .env",
10+
"postCreateCommand": "apt update && apt install -y sudo && ./startupscript/post-startup.sh jupyter /home/jupyter ${templateOption:cloud} ${templateOption:login} && printf 'alias weightsbiases=\"/usr/local/bin/wb\"\\nalias wb=\"/usr/bin/wb\"\\n' >> /home/jupyter/.bashrc",
11+
// re-mount bucket files on container start up
12+
"postStartCommand": [
13+
"./startupscript/remount-on-restart.sh",
14+
"jupyter",
15+
"/home/jupyter",
16+
"${templateOption:cloud}",
17+
"${templateOption:login}"
18+
],
19+
"features": {
20+
"ghcr.io/devcontainers/features/java@sha256:df67d6ff6e9cdd858207ae9e92a99ddb88384b789f79eecd6f873216e951d286": {
21+
"version": "17"
22+
},
23+
"ghcr.io/dhoeric/features/google-cloud-cli@sha256:fa5d894718825c5ad8009ac8f2c9f0cea3d1661eb108a9d465cba9f3fc48965f": {},
24+
"ghcr.io/devcontainers/features/aws-cli@sha256:bbc9fd513c22e331953126c75ad7b2ed1f9044f1cd5890b7073b634810459b18":{}
25+
},
26+
"remoteUser": "root",
27+
"customizations": {
28+
"workbench": {
29+
"opens": {
30+
"extensions": [
31+
// Source
32+
".ipynb",
33+
".R",
34+
".py",
35+
// Documents
36+
".md",
37+
".html",
38+
".latex",
39+
".pdf",
40+
// Images
41+
".bmp",
42+
".gif",
43+
".jpeg",
44+
".jpg",
45+
".png",
46+
".svg",
47+
// Data
48+
".csv",
49+
".tsv",
50+
".json",
51+
".vl"
52+
],
53+
"fileUrlSuffix": "/lab/tree/{path}",
54+
"folderUrlSuffix": "/lab/tree/{path}"
55+
}
56+
}
57+
}
58+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Use the official NVIDIA Clara Parabricks container as the base image
2+
FROM nvcr.io/nvidia/clara/clara-parabricks:4.5.1-1
3+
4+
# Set the default shell for subsequent commands to bash.
5+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
6+
7+
ARG NB_USER=jupyter
8+
ARG NB_UID=1010
9+
ARG NB_GID=1000
10+
ARG WORKDIR=/home/${NB_USER}
11+
12+
# Switch to root user to install packages and create new user
13+
USER root
14+
15+
# This folder caused java installation issues, removing it resolves this
16+
RUN rm -rf /var/lib/apt/lists/*
17+
18+
RUN \
19+
mkdir -p /etc/sudoers.d/ \
20+
# Create the user and set their shell directly in one step.
21+
# This avoids potential errors with 'groupadd' and makes 'chsh' redundant.
22+
&& groupadd --gid ${NB_GID} ${NB_USER} && useradd --uid ${NB_UID} --gid ${NB_GID} --create-home --home-dir ${WORKDIR} --shell /bin/bash ${NB_USER} \
23+
# Grant password-less sudo access to the new user
24+
&& echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${NB_USER} \
25+
&& chmod 0440 /etc/sudoers.d/${NB_USER}
26+
27+
# Fix ownership for common dirs
28+
RUN mkdir -p /workspace \
29+
&& chown -R ${NB_UID}:${NB_GID} ${WORKDIR} /workspace /tmp \
30+
&& chown -R ${NB_UID}:${NB_GID} /opt/conda || true
31+
32+
33+
34+
# Environment and working directory
35+
ENV HOME=${WORKDIR}
36+
WORKDIR ${WORKDIR}
37+
38+
ENV PATH="${WORKDIR}/.local/bin:${PATH}"
39+
# Switch to non-root user
40+
USER ${NB_USER}
41+
ENV SHELL=/bin/bash
42+
43+
# Create a Jupyter config file to force the terminal to use bash
44+
# RUN mkdir -p ~/.jupyter/ && \
45+
# echo "c.ServerApp.terminado_settings = {'shell_command': ['/bin/bash']}" > ~/.jupyter/jupyter_server_config.py
46+
47+
# Install Jupyter Lab using pip
48+
RUN pip3 install jupyterlab
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": "Jupyterlab on Parabricks",
3+
"description": "A template used to serve the Workbench JupyterLab container image plus NVIDIA Parabricks",
4+
"version": "0.0.1",
5+
"name": "NVIDIA Parabricks container with Jupyterlab installed",
6+
"documentationURL": "https://github.com/verily-src/workbench-app-devcontainers/tree/master/src/custom-workbench-jupyter-template",
7+
"licenseURL": "https://github.com/verily-src/workbench-app-devcontainers/blob/master/LICENSE",
8+
"options": {
9+
"cloud": {
10+
"type": "string",
11+
"description": "VM cloud environment",
12+
"proposals": ["gcp", "aws"],
13+
"default": "gcp"
14+
},
15+
"login": {
16+
"type": "string",
17+
"description": "Whether to log in to workbench CLI",
18+
"proposals": ["true", "false"],
19+
"default": "false"
20+
}
21+
},
22+
"platforms": ["Any"]
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: "2.4"
2+
services:
3+
app:
4+
container_name: "application-server"
5+
build:
6+
context: .
7+
user: jupyter
8+
restart: always
9+
volumes:
10+
- .:/workspace:cached
11+
ports:
12+
- "8888:8888"
13+
networks:
14+
- app-network
15+
cap_add:
16+
- SYS_ADMIN
17+
devices:
18+
- /dev/fuse
19+
security_opt:
20+
- apparmor:unconfined
21+
command: ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--LabApp.token=''"]
22+
networks:
23+
app-network:
24+
external: true

0 commit comments

Comments
 (0)