-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from guimou/dev
Add VSCode to JupyterHub images
- Loading branch information
Showing
11 changed files
with
2,116 additions
and
1 deletion.
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
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Code Server Notebook | ||
|
||
Custom notebook based on ODH Minimal notebook, adding: | ||
|
||
* VSCode (Code Server) |
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 |
---|---|---|
@@ -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 |
32 changes: 32 additions & 0 deletions
32
...ub-images/vscode-notebook/container/jupyter-vscode-proxy/jupyter_vscode_proxy/__init__.py
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 |
---|---|---|
@@ -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 | ||
} | ||
} |
368 changes: 368 additions & 0 deletions
368
...e-notebook/container/jupyter-vscode-proxy/jupyter_vscode_proxy/icons/vscode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
jupyterhub-images/vscode-notebook/container/jupyter-vscode-proxy/setup.cfg
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[metadata] |
23 changes: 23 additions & 0 deletions
23
jupyterhub-images/vscode-notebook/container/jupyter-vscode-proxy/setup.py
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 |
---|---|---|
@@ -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
16
jupyterhub-images/vscode-notebook/container/requirements.in
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 |
---|---|---|
@@ -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
1,607
jupyterhub-images/vscode-notebook/container/requirements.txt
Large diffs are not rendered by default.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...b-images/vscode-notebook/deploy/odh-generic-data-science-vscode-notebook_image-stream.yml
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 |
---|---|---|
@@ -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 |