This repository was archived by the owner on Nov 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
containers/codespaces-linux/.devcontainer Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
72
72
RUN bash /tmp/scripts/python-debian.sh "none" "/opt/python/latest" "${PIPX_HOME}" "${USERNAME}" "true" \
73
73
# Install JupyterLab and common machine learning packages
74
74
&& PYTHON_BINARY="${PYTHON_ROOT}/current/bin/python" \
75
- && bash /tmp/scripts/jupyterlab-debian.sh "latest" "automatic" ${PYTHON_BINARY} \
75
+ && bash /tmp/scripts/jupyterlab-debian.sh "latest" "automatic" ${PYTHON_BINARY} "true" \
76
76
&& bash /tmp/scripts/setup-python-tools.sh ${PYTHON_BINARY} \
77
77
# Install rvm, rbenv, any missing base gems
78
78
&& chown -R ${USERNAME} /opt/ruby/* \
Original file line number Diff line number Diff line change 14
14
VERSION=${1:- " latest" }
15
15
USERNAME=${2:- " automatic" }
16
16
PYTHON=${3:- " python" }
17
+ ALLOW_ORIGIN=${4:- " " }
17
18
18
19
# If in automatic mode, determine if a user already exists, if not use vscode
19
20
if [ " ${USERNAME} " = " auto" ] || [ " ${USERNAME} " = " automatic" ]; then
@@ -43,6 +44,18 @@ sudoUserIf() {
43
44
fi
44
45
}
45
46
47
+ addToJupyterConfig () {
48
+ JUPYTER_DIR=" /home/${USERNAME} /.jupyter"
49
+ JUPYTER_CONFIG=" ${JUPYTER_DIR} /jupyter_notebook_config.py"
50
+
51
+ # Make sure the config file exists
52
+ test -d ${JUPYTER_DIR} || sudoUserIf mkdir ${JUPYTER_DIR}
53
+ test -f ${JUPYTER_CONFIG} || sudoUserIf touch ${JUPYTER_CONFIG}
54
+
55
+ # Don't write the same line more than once
56
+ grep -q ${1} ${JUPYTER_CONFIG} || echo ${1} >> ${JUPYTER_CONFIG}
57
+ }
58
+
46
59
# Make sure that Python is available
47
60
if ! ${PYTHON} --version > /dev/null ; then
48
61
echo " You need to install Python before installing JupyterLab."
@@ -56,3 +69,7 @@ if [ "${VERSION}" = "latest" ]; then
56
69
else
57
70
sudoUserIf ${PYTHON} -m pip install jupyterlab==" ${VERSION} " --no-cache-dir
58
71
fi
72
+
73
+ if [ " ${ALLOW_ORIGIN} " = ' true' ]; then
74
+ addToJupyterConfig " c.ServerApp.allow_origin = '*'"
75
+ fi
Original file line number Diff line number Diff line change 14
14
VERSION=${1:- " latest" }
15
15
USERNAME=${2:- " automatic" }
16
16
PYTHON=${3:- " python" }
17
+ ALLOW_ORIGIN=${4:- " " }
17
18
18
19
# If in automatic mode, determine if a user already exists, if not use vscode
19
20
if [ " ${USERNAME} " = " auto" ] || [ " ${USERNAME} " = " automatic" ]; then
@@ -43,6 +44,18 @@ sudoUserIf() {
43
44
fi
44
45
}
45
46
47
+ addToJupyterConfig () {
48
+ JUPYTER_DIR=" /home/${USERNAME} /.jupyter"
49
+ JUPYTER_CONFIG=" ${JUPYTER_DIR} /jupyter_notebook_config.py"
50
+
51
+ # Make sure the config file exists
52
+ test -d ${JUPYTER_DIR} || sudoUserIf mkdir ${JUPYTER_DIR}
53
+ test -f ${JUPYTER_CONFIG} || sudoUserIf touch ${JUPYTER_CONFIG}
54
+
55
+ # Don't write the same line more than once
56
+ grep -q ${1} ${JUPYTER_CONFIG} || echo ${1} >> ${JUPYTER_CONFIG}
57
+ }
58
+
46
59
# Make sure that Python is available
47
60
if ! ${PYTHON} --version > /dev/null ; then
48
61
echo " You need to install Python before installing JupyterLab."
@@ -56,3 +69,7 @@ if [ "${VERSION}" = "latest" ]; then
56
69
else
57
70
sudoUserIf ${PYTHON} -m pip install jupyterlab==" ${VERSION} " --no-cache-dir
58
71
fi
72
+
73
+ if [ " ${ALLOW_ORIGIN} " = ' true' ]; then
74
+ addToJupyterConfig " c.ServerApp.allow_origin = '*'"
75
+ fi
You can’t perform that action at this time.
0 commit comments