diff --git a/qhub/template/image/Dockerfile.jupyterlab b/qhub/template/image/Dockerfile.jupyterlab index 159229711..9fab8d700 100644 --- a/qhub/template/image/Dockerfile.jupyterlab +++ b/qhub/template/image/Dockerfile.jupyterlab @@ -44,6 +44,10 @@ RUN \ fi ; \ /opt/scripts/install-conda-environment.sh "${ENV_FILE}" 'true' +# ========== code-server install ============ +ENV PATH=/opt/conda/envs/${DEFAULT_ENV}/share/code-server/bin:${PATH} +COPY scripts/install-code-server.sh /opt/scripts/install-code-server.sh + COPY jupyterlab /opt/jupyterlab RUN /opt/jupyterlab/postBuild diff --git a/qhub/template/image/jupyterlab/environment.yaml b/qhub/template/image/jupyterlab/environment.yaml index 6611c4d3c..954fb5a05 100644 --- a/qhub/template/image/jupyterlab/environment.yaml +++ b/qhub/template/image/jupyterlab/environment.yaml @@ -19,7 +19,7 @@ dependencies: - retrolab # jupyterlab extensions -# - dask_labextension >=5.0.0 + - dask_labextension >= 5.3.0 - jupyterlab-git >=0.30.0 - sidecar >=0.5.0 - jupyter-videochat >=0.5.0 @@ -48,10 +48,6 @@ dependencies: - isort - importnb - # vscode - - code-server >= 3.2 - - pip: # vscode jupyterlab launcher - git+https://github.com/betatim/vscode-binder - - git+https://github.com/dask/dask-labextension.git@fc8de03447778e0605d0abafa3d3135f9e49e0d6 diff --git a/qhub/template/image/jupyterlab/postBuild b/qhub/template/image/jupyterlab/postBuild index 34f7ad1fb..4fad3d41c 100755 --- a/qhub/template/image/jupyterlab/postBuild +++ b/qhub/template/image/jupyterlab/postBuild @@ -5,6 +5,10 @@ set -x # install classic notebook extensions jupyter nbextension enable --py widgetsnbextension --sys-prefix +# install code-server extension +sh /opt/scripts/install-code-server.sh "/opt/conda/envs/${DEFAULT_ENV}/share" + + # if DEFAULT_ENV is unset ${DEFAULT_ENV+x} expands to nothing otherwise # it substitutes the string x. This allows us to check if the variable # is set without triggering an unbound variable error diff --git a/qhub/template/image/scripts/install-code-server.sh b/qhub/template/image/scripts/install-code-server.sh new file mode 100644 index 000000000..0184150ac --- /dev/null +++ b/qhub/template/image/scripts/install-code-server.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -xe +DEFAULT_PREFIX="${1}"; shift # path to environment yaml or lock file + +mkdir -p ${DEFAULT_PREFIX}/code-server +cd ${DEFAULT_PREFIX}/code-server + +# Fetch the snapshot of https://code-server.dev/install.sh as of the time of writing +wget --quiet https://raw.githubusercontent.com/coder/code-server/326a1d1862872955cec062030df2bd103799a1eb/install.sh +expected_sum=ed18563871beb535130019b6c5b62206cc4a60c8bf4256aae96ce737951fc253 + +if [[ ! $(sha256sum install.sh) == "${expected_sum} install.sh" ]];then + echo Unexpected hash from code-server install script + exit 1 +fi + +mkdir /opt/tmpdir +sh ./install.sh --method standalone --prefix /opt/tmpdir + +mv /opt/tmpdir/lib/code-server-4.5.0/* ${DEFAULT_PREFIX}/code-server +rm -rf /opt/tmpdir