File size: 1,028 Bytes
db5855f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

set -x

set -eo pipefail

APP_ROOT=${APP_ROOT:-/opt/app-root}


# Run the original Python S2I assemble script to install packages.

/usr/libexec/s2i/assemble

# Enable required extensions

if [ -f "$APP_ROOT/src/extensions.in" ]; then
    while IFS= read -r extension; do
        jupyter nbextension enable --sys-prefix $extension
    done < "$APP_ROOT/src/extensions.in"
fi

# Apply custom notebook configuration

if [ -d "$APP_ROOT/src/.jupyter/" ]; then
    rsync \
        --link-dest="$APP_ROOT/src/.jupyter/" \
        --recursive \
        --verbose \
        "$APP_ROOT/src/.jupyter/" ${APP_ROOT}/etc/jupyter
fi

# Move files from application source directory to master files directory
# if directory has been specified. This is to facilitate later copying
# of files into a persistent volume on startup of instance.

if [ x"$JUPYTER_MASTER_FILES" != x"" ]; then
    mkdir -p $JUPYTER_MASTER_FILES
    shopt -s dotglob
    mv $APP_ROOT/src/* $JUPYTER_MASTER_FILES
fi