jupyter-desktop-server/binder/postBuild

75 lines
2.4 KiB
Bash

#!/bin/bash
set -eux
env
VNC_APPLICATION_DIR=$CONDA_DIR/vnc
mkdir $VNC_APPLICATION_DIR
pushd $VNC_APPLICATION_DIR
# Novnc: just want web files
curl -sSfL https://github.com/novnc/noVNC/archive/v1.1.0.tar.gz | tar -zxf -
# Patch novnc to use correct path to websockify (defaults to /)
# Note if you use vnc.html you will need to patch ui.js to use the correct path
# and also to override localstorage which may store an incorrect path from a
# different session
# Also resize server instead of scaling client
sed -i.bak \
-e "s%\('path', 'websockify'\)%'path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify'); console.log('websockify path:' + path%" \
-re "s%rfb.scaleViewport = .+%rfb.resizeSession = readQueryVariable('resize', true);%" \
noVNC-1.1.0/vnc_lite.html
# Install tigervnc
curl -sSfL 'https://bintray.com/tigervnc/stable/download_file?file_path=tigervnc-1.9.0.x86_64.tar.gz' | tar -zxf - --strip=2
cp $REPO_DIR/jupyter_desktop/share/xstartup .
chmod +x xstartup
# Desktop applications
# Fiji and OMERO insight
#OMERO_INSIGHT_VERSION=5.5.6
#OMERO_INSIGHT_URL_BASE=https://github.com/ome/omero-insight/releases/download/v$OMERO_INSIGHT_VERSION/
OMERO_INSIGHT_VERSION=5.5.7-SNAPSHOT
OMERO_INSIGHT_URL_BASE=https://users.openmicroscopy.org.uk/~spli/insight
wget -q https://downloads.imagej.net/fiji/latest/fiji-nojre.zip
unzip -q fiji-nojre.zip
rm fiji-nojre.zip
pushd Fiji.app/plugins
wget -q $OMERO_INSIGHT_URL_BASE/OMERO.imagej-$OMERO_INSIGHT_VERSION.zip
unzip -q OMERO.imagej-$OMERO_INSIGHT_VERSION.zip
rm OMERO.imagej-$OMERO_INSIGHT_VERSION.zip
popd
wget -q $OMERO_INSIGHT_URL_BASE/OMERO.insight-$OMERO_INSIGHT_VERSION.zip
unzip -q OMERO.insight-$OMERO_INSIGHT_VERSION.zip
rm OMERO.insight-$OMERO_INSIGHT_VERSION.zip
pushd OMERO.insight-$OMERO_INSIGHT_VERSION && \
wget -q https://www.openmicroscopy.org/img/logos/omero-logomark.svg
popd
ln -s OMERO.insight-$OMERO_INSIGHT_VERSION OMERO.insight
mkdir Desktop
cp $REPO_DIR/jupyter_desktop/share/*.desktop Desktop
chmod +x Desktop/*.desktop
popd
pushd $REPO_DIR/jupyter_desktop
# Configure jupyter-server-proxy VNC
# https://jupyter-server-proxy.readthedocs.io/en/latest/server-process.html#specifying-config-from-python-packages
pip install .
python -c "from pkg_resources import iter_entry_points; print(list(iter_entry_points(group='jupyter_serverproxy_servers')))"
popd
# Napari (dependencies already installed using conda)
pip install --no-dependencies napari==0.2.2