Commit 6279a2f5 authored by Eszter Schoell's avatar Eszter Schoell
Browse files

move to binderhub

parent 5da6f168
Loading
Loading
Loading
Loading
+5 −6
Changes for Dockerfile: 5 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -11,19 +11,18 @@ COPY notebooks/private_key.pem /home/jovyan/notebooks/
COPY notebooks/public_key.der /home/jovyan/notebooks/
COPY solutions/ /home/jovyan/solutions
COPY requirements.txt /
COPY postBuild /home/jovyan/postBuild

# Modules
RUN pip install -r /requirements.txt && \
    rm -fR /home/jovyan/work
RUN pip install -r /requirements.txt

# Allow user to write to directory
USER root
RUN chown -R $NB_USER /home/jovyan \
    && chmod -R 774 /home/jovyan
    && chmod -R 774 /home/jovyan \
    && rm -fR /home/jovyan/work \
    && /home/jovyan/postBuild
USER $NB_USER

# Expose the notebook port
EXPOSE 8888

# Start the notebook server
CMD jupyter notebook --no-browser --port 8888 --ip='0.0.0.0' --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True --NotebookApp.iopub_data_rate_limit=1.0e10

create_jh/Dockerfile

deleted100644 → 0
+0 −28
Changes for create_jh/Dockerfile: 0 added lines, 28 removed lines.
Original line number Diff line number Diff line
FROM us.gcr.io/jupyterhub-170614/0636920267195:v0.1

USER root

# notebook and ipykernel should already be installed. now just need jupyterhub
RUN pip install --upgrade --no-cache-dir jupyterhub==0.8.1

# Specify tornado==4.5.3
RUN pip install --upgrade --no-cache-dir tornado==4.5.3

USER jovyan

WORKDIR /home/jovyan

# css stuff
RUN for i in `find / -wholename /opt/conda/*/custom.css 2>/dev/null` ; \
  do echo "@import url(\"https://cdn.oreillystatic.com/jupyterhub/jupyterhub-theme/custom/custom.css\")" \
  | tee ${i}; done

CMD jupyterhub-singleuser \
  --port=8888 \
  --ip=0.0.0.0 \
  --user="$JPY_USER" \
  --cookie-name=$JPY_COOKIE_NAME \
  --base-url=$JPY_BASE_URL \
  --hub-prefix=$JPY_HUB_PREFIX \
  --hub-api-url=$JPY_HUB_API_URL \

postBuild

0 → 100755
+50 −0
Changes for postBuild: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/bin/bash

CONTEXT_IDENTIFIER='666333TESTNTBK6633'
NOTEBOOK_FPID='666333TESTNTBK6633'

# timestamp to invalidate JupyterHub server cache
TIMESTAMP=`date +'%s'`

# add CodeMirror config
mkdir -p ~/.jupyter/nbconfig
echo '{"CodeCell":{"cm_config":{"lineNumbers":true,"theme":"oreillybat"}}}' \
    > ~/.jupyter/nbconfig/notebook.json

# configure custom templates
mkdir -p ~/.jupyter/templates
echo "c.NotebookApp.extra_template_paths = ['~/.jupyter/templates']" \
    > ~/.jupyter/jupyter_notebook_config.py

cat << EOF > ~/.jupyter/templates/page.html
{% extends "templates/page.html" %}

{% block stylesheet %}
{# stylesheets and any js that needs to load before everything else #}
<link rel="stylesheet" href="https://new-content.binderhub-prod.gcp.oreilly.com/extra_static/custom.css" type="text/css"/>
<script>
  window.notebookIdentifier = '$NOTEBOOK_FPID';
  window.contextIdentifier = '$CONTEXT_IDENTIFIER';
</script>
<script src="https://new-content.binderhub-prod.gcp.oreilly.com/extra_static/oreilly-notebooks-usage-meter.min.js?t=$TIMESTAMP"></script>
<script src="https://new-content.binderhub-prod.gcp.oreilly.com/extra_static/notebook-custom-vendor.js?t=$TIMESTAMP"></script>
<script src="https://new-content.binderhub-prod.gcp.oreilly.com/extra_static/notebook-custom-head.js?t=$TIMESTAMP"></script>
{{super()}}
{% endblock %}

{% block script %}
{{super()}}
{# js that should load after dom is ready #}
<script src="https://new-content.binderhub-prod.gcp.oreilly.com/extra_static/notebook-custom-body.js?t=$TIMESTAMP"></script>
{% endblock %}
EOF

BINDER_DIR=`dirname "${0}"`
rm "${0}"

if [ -f "${BINDER_DIR}/postBuild.original" ]
then
  mv "${BINDER_DIR}/postBuild.original" "${BINDER_DIR}/postBuild"
fi

# vim: ft=sh
 No newline at end of file