Skip to content
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
44 changes: 44 additions & 0 deletions .github/workflows/build_push_jupyterlab_generic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Push Jupyterlab Generic Image to quay

on:
push:
paths:
- jupyterlab-generic/**
- .github/workflows/build_push_jupyterlab_generic.yml
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract branch name
id: extract_branch
run: |
echo "IMAGE_TAG=$(echo ${GITHUB_REF#refs/*/} | tr / _)"
echo "IMAGE_TAG=$(echo ${GITHUB_REF#refs/*/} | tr / _)" >> $GITHUB_ENV

- name: Login to Quay.io
id: login
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
quay.io/cdis/jupyterlab-generic:${{ env.IMAGE_TAG }}

- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: ./jupyterlab-generic
file: "./jupyterlab-generic/Dockerfile"
push: true
tags: |
quay.io/cdis/jupyterlab-generic:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
18 changes: 5 additions & 13 deletions jupyterlab-generic/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
# Generic Gen3 JupyterLab workspace

FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal AS builder-image
FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal
LABEL maintainer="Center for Translational Data Science (CTDS)"
LABEL name="jupyterlab-generic"

# TODO: git, nodejs, and build are all required only to build jupyterlmod;
# these can be dropped once jupyterlmod fix is available in PyPI.
RUN dnf upgrade --refresh && \
dnf install -y python3.13 python3.13-pip git nodejs && \
dnf install -y python3.13 python3.13-pip git nodejs shadow-utils which && \
python3.13 -m venv /usr/local/python-venv && \
source /usr/local/python-venv/bin/activate && \
pip install --upgrade pip && \
pip install jupyterlab && \
pip install build && \
pip install jupyterlmod git+https://github.com/pschumm/jupyter-lmod@pschumm/fix_hidden && \
pip install jupyterlab-git &&\
pip install jupyterlab-git && \
pip install jupyterlab-search-replace


FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal AS runner-image
LABEL maintainer="Center for Translational Data Science (CTDS)"
LABEL name="jupyterlab-generic"

RUN dnf upgrade --refresh && \
dnf install -y shadow-utils which python3.13 && \
python3.13 -m venv /usr/local/python-venv

COPY --from=builder-image /usr/local/python-venv /usr/local/python-venv
RUN /usr/local/python-venv/bin/jupyter kernelspec remove -y python3

COPY jupyterlab-start.sh .
Expand Down
34 changes: 16 additions & 18 deletions jupyterlab-generic/jupyterlab-start.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
#!/usr/bin/env bash

# Symlink config files for persistence
test -f ./pd/.bash_profile || touch ./pd/.bash_profile
test -f ./pd/.bashrc || touch ./pd/.bashrc
test -d ./pd/.jupyter || mkdir ./pd/.jupyter
test -d ./pd/.ipython || mkdir ./pd/.ipython
test -d ./pd/.config || mkdir ./pd/.config
test -d ./pd/.local || mkdir ./pd/.local
ln -s ./pd/.bash_profile .
ln -s ./pd/.bashrc .
ln -s ./pd/.jupyter .
ln -s ./pd/.ipython .
ln -s ./pd/.config .
ln -s ./pd/.local .

# Symlink data directory mounted at root
ln -s /data .
# # Symlink config files for persistence
# test -f ./pd/.bash_profile || touch ./pd/.bash_profile
# test -f ./pd/.bashrc || touch ./pd/.bashrc
# test -d ./pd/.jupyter || mkdir ./pd/.jupyter
# test -d ./pd/.ipython || mkdir ./pd/.ipython
# test -d ./pd/.config || mkdir ./pd/.config
# test -d ./pd/.local || mkdir ./pd/.local
# ln -s ./pd/.bash_profile .
# ln -s ./pd/.bashrc .
# ln -s ./pd/.jupyter .
# ln -s ./pd/.ipython .
# ln -s ./pd/.config .
# ln -s ./pd/.local .

# Load JupyterLab extension dependencies
source /apps/lmod/lmod/init/profile
Expand All @@ -24,7 +21,8 @@ module load git ripgrep
module load py-pandas py-scipy

/usr/local/python-venv/bin/jupyter lab \
--ip=0.0.0.0 \
--ServerApp.ip=0.0.0.0 \
--KernelSpecManager.ensure_native_kernel=False \
--ServerApp.quit_button=False \
--IdentityProvider.token=""
--IdentityProvider.token="" \
"$@"