Skip to content

Commit

Permalink
Merge pull request #15 from guimou/dev
Browse files Browse the repository at this point in the history
Add VSCode to JupyterHub images
  • Loading branch information
guimou authored Oct 23, 2022
2 parents 9f33c3f + 08d2c3f commit 81ebdcb
Show file tree
Hide file tree
Showing 11 changed files with 2,116 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Nothing

## [0.0.14] - 2022-10-23

- VSCode notebook in the `jupyterhub-images` folder. This is a JupyterLab Data Science notebook that also includes VSCode 4.7.1. This image works both with JupyterHub and current ODH/RHODS dashboard version (contrary to the image in `notebook-controller-images` that works only with the Kubeflow Notebook Controller and is not compatible with ODH/RHODS dashboard).

## [0.0.13] - 2022-10-05

- Monai notebook in the `notebook-controller-images` line. As it's not thoroughly tested it's still not officially released
Expand Down
3 changes: 2 additions & 1 deletion jupyterhub-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Pre-built versions of the images are available:
* R: https://quay.io/guimou/odh-minimal-data-science-r-notebook
* SageMath: https://quay.io/guimou/s2i-minimal-data-science-sagemath-notebook
* Streamlit: https://quay.io/guimou/s2i-generic-data-science-streamlit-notebook
* Monai: https://quay.io/repository/guimou/s2i-monai-notebook
* Monai: https://quay.io/guimou/guimou/s2i-monai-notebook
* VSCode: https://quay.io/guimou/odh-generic-data-science-vscode-notebook
5 changes: 5 additions & 0 deletions jupyterhub-images/vscode-notebook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Code Server Notebook

Custom notebook based on ODH Minimal notebook, adding:

* VSCode (Code Server)
29 changes: 29 additions & 0 deletions jupyterhub-images/vscode-notebook/container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM quay.io/guimou/s2i-datascience-notebook-ubi9-py39:latest

ARG CODESERVER_VERSION=v4.7.1

####################
# CodeServer #
####################

USER 0

WORKDIR /tmp

RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-amd64.rpm" && \
yum -y clean all && \
rm -rf /var/cache/dnf

COPY ./jupyter-vscode-proxy /tmp/jupyter-vscode-proxy

# Install launcher package
RUN pip install --no-cache-dir /tmp/jupyter-vscode-proxy && \
fix-permissions /opt/app-root

ENV SHELL /usr/bin/sh

WORKDIR /opt/app-root/src

USER 1001

CMD /opt/app-root/bin/start-singleuser.sh --ip=0.0.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import getpass
import os
import pathlib
import shutil
import subprocess
import tempfile
from textwrap import dedent
from urllib.parse import urlparse, urlunparse

def setup_vscode():
def _vscode_command(port):
working_dir = os.getenv("CODE_WORKINGDIR", None)
if working_dir is None:
working_dir = os.getenv("JUPYTER_SERVER_ROOT", ".")

return ['code-server',
f'--port={port}',
"--auth=none",
"--disable-telemetry",
"--disable-update-check",
"--host=127.0.0.1",
working_dir ]

return {
'command': _vscode_command,
'timeout': 30,
'launcher_entry': {
'title': 'VS Code',
'icon_path': os.path.join(os.path.dirname(os.path.abspath(__file__)), 'icons', 'vscode.svg'),
'enabled': True
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[metadata]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import setuptools

setuptools.setup(
name="jupyter-vscode-proxy",
version='0.0.1',
url="https://github.com/guimou",
author="Guillaume Moutier",
description="Jupyter extension to proxy VS Code (Code Server)",
packages=setuptools.find_packages(),
keywords=['Jupyter'],
classifiers=['Framework :: Jupyter'],
install_requires=[
'jupyter-server-proxy>=3.2.0'
],
entry_points={
'jupyter_serverproxy_servers': [
'vscode = jupyter_vscode_proxy:setup_vscode'
]
},
package_data={
'jupyter_vscode_proxy': ['icons/vscode.svg'],
},
)
16 changes: 16 additions & 0 deletions jupyterhub-images/vscode-notebook/container/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--index-url https://pypi.org/simple
#
# Default dependencies
#
## Forced to update packages due to JL issue with RStudio
ipython<8.0.0
notebook==6.4.6
jupyterhub==1.3.0
jupyterlab==3.1.18
jupyterlab-requirements==0.15.0
jupyter_kernel_gateway==2.4.0
jupyter-nbrequirements==0.7.3
supervisor==4.1.0
jupyterlab-git==0.30
jupyterlab-spellchecker==0.7.2
jupyter-server-proxy==3.2.1
1,607 changes: 1,607 additions & 0 deletions jupyterhub-images/vscode-notebook/container/requirements.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
annotations:
opendatahub.io/notebook-image-desc: >-
JupyterLab Data Science notebook image with VS Code.
opendatahub.io/notebook-image-name: VS Code Notebook
opendatahub.io/notebook-image-order: '200'
opendatahub.io/notebook-image-url: 'https://github.com/guimou/custom-notebooks/tree/main/vscode-notebook'
name: odh-generic-data-science-vscode-notebook
labels:
component.opendatahub.io/name: jupyterhub
opendatahub.io/component: 'true'
opendatahub.io/notebook-image: 'true'
spec:
lookupPolicy:
local: true
tags:
- name: latest
annotations:
opendatahub.io/notebook-python-dependencies: >-
[{"name":"VS Code","version":"4.7.1"}]
opendatahub.io/notebook-software: '[{"name":"BYO Notebook Image -
VSCode","version":"4.7.1"},{"name":"VSCode","version":"4.7.1"}]'
from:
kind: DockerImage
name: 'quay.io/guimou/odh-generic-data-science-vscode-notebook:latest'
referencePolicy:
type: Source

0 comments on commit 81ebdcb

Please sign in to comment.