-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b530407
commit 5cea969
Showing
7 changed files
with
414 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
FROM alpine:3.5 | ||
LABEL maintainer "Zac Flamig <[email protected]>" | ||
|
||
RUN apk --no-cache add \ | ||
bash \ | ||
ca-certificates \ | ||
cmake \ | ||
freetype-dev \ | ||
g++ \ | ||
gcc \ | ||
gfortran \ | ||
git \ | ||
jpeg-dev \ | ||
lapack-dev \ | ||
libffi-dev \ | ||
libpng-dev \ | ||
libstdc++ \ | ||
linux-headers \ | ||
m4 \ | ||
make \ | ||
musl-dev \ | ||
openssl-dev \ | ||
python3 \ | ||
python3-dev \ | ||
tini \ | ||
wget \ | ||
zlib-dev \ | ||
&& ln -s /usr/include/locale.h /usr/include/xlocale.h \ | ||
&& pip3 install --upgrade pip \ | ||
&& python3 -m pip --no-cache-dir install \ | ||
numpy | ||
|
||
RUN apk add --no-cache --virtual .build-deps-edge \ | ||
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ | ||
proj \ | ||
proj-util \ | ||
proj-dev | ||
|
||
# HDF5 Installation | ||
RUN wget https://www.hdfgroup.org/package/bzip2/?wpdmdl=4300 \ | ||
&& mv "index.html?wpdmdl=4300" hdf5-1.10.1.tar.bz2 \ | ||
&& tar xf hdf5-1.10.1.tar.bz2 \ | ||
&& cd hdf5-1.10.1 \ | ||
&& ./configure --prefix=/usr --enable-cxx --with-zlib=/usr/include,/usr/lib/x86_64-linux-gnu \ | ||
&& make -j4 \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& rm -rf hdf5-1.10.1 \ | ||
&& rm -rf hdf5-1.10.1.tar.bz2 \ | ||
&& export HDF5_DIR=/usr | ||
|
||
RUN HDF5_LIBDIR=/usr/lib HDF5_INCDIR=/usr/include python3 -m pip --no-cache-dir install \ | ||
--no-binary=h5py h5py | ||
|
||
# NetCDF Installation | ||
RUN wget https://github.com/Unidata/netcdf-c/archive/v4.4.1.1.tar.gz \ | ||
&& tar xf v4.4.1.1.tar.gz \ | ||
&& cd netcdf-c-4.4.1.1 \ | ||
&& ./configure --prefix=/usr \ | ||
&& make -j4 \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& rm -rf netcdf-c-4.4.1.1 \ | ||
&& rm -rf v4.4.1.1.tar.gz | ||
|
||
# GEOS Installation | ||
RUN wget http://download.osgeo.org/geos/geos-3.6.2.tar.bz2 \ | ||
&& tar xf geos-3.6.2.tar.bz2 \ | ||
&& cd geos-3.6.2 \ | ||
&& ./configure --prefix=/usr \ | ||
&& make -j4 \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& rm -rf geos-3.6.2 \ | ||
&& rm -rf geos-3.6.2.tar.bz2 | ||
|
||
# GDAL Installation | ||
RUN git clone https://github.com/OSGeo/gdal.git /gdalgit \ | ||
&& cd /gdalgit/gdal \ | ||
&& ./configure --prefix=/usr \ | ||
&& make \ | ||
&& make install \ | ||
&& cd / \ | ||
&& rm -rf gdalgit | ||
|
||
RUN HDF5_LIBDIR=/usr/lib HDF5_INCDIR=/usr/include PROJ_DIR=/usr python3 -m pip --no-cache-dir install \ | ||
boto3 \ | ||
Cython \ | ||
dask-kubernetes \ | ||
fiona \ | ||
gdal \ | ||
geopandas \ | ||
jupyterhub \ | ||
jupyterlab \ | ||
matplotlib \ | ||
netcdf4 \ | ||
notebook \ | ||
pandas \ | ||
pyproj \ | ||
requests \ | ||
https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz \ | ||
scipy \ | ||
scikit-learn \ | ||
shapely \ | ||
&& mkdir /notebooks | ||
|
||
# https://github.com/SciTools/cartopy/pull/1289 | ||
RUN python3 -m pip --no-cache-dir install \ | ||
git+https://github.com/snowman2/cartopy.git@5e624fe | ||
|
||
# Install Tini | ||
RUN wget --quiet https://github.com/krallin/tini/releases/download/v0.10.0/tini && \ | ||
echo "1361527f39190a7338a0b434bd8c88ff7233ce7b9a4876f3315c22fce7eca1b0 *tini" | sha256sum -c - && \ | ||
mv tini /usr/local/bin/tini && \ | ||
chmod +x /usr/local/bin/tini | ||
|
||
# Configure environment | ||
ENV CONDA_DIR /opt/conda | ||
ENV PATH /usr/local/bin:$PATH | ||
ENV SHELL /bin/bash | ||
ENV NB_USER jovyan | ||
ENV NB_UID 1000 | ||
ENV HOME /home/$NB_USER | ||
ENV LC_ALL en_US.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US.UTF-8 | ||
|
||
# Create jovyan user with UID=1000 and in the 'users' group | ||
RUN adduser -H -D -s /bin/bash -u $NB_UID $NB_USER && \ | ||
mkdir -p $HOME/work && \ | ||
chown -R $NB_USER $HOME | ||
|
||
EXPOSE 8888 | ||
WORKDIR /home/$NB_USER/work | ||
|
||
# Configure container startup | ||
ENTRYPOINT ["/sbin/tini", "--"] | ||
CMD ["start-notebook.sh"] | ||
|
||
# Add local files as late as possible to avoid cache busting | ||
COPY start.sh /usr/local/bin/ | ||
COPY start-notebook.sh /usr/local/bin/ | ||
COPY start-singleuser.sh /usr/local/bin/ | ||
RUN chmod +x /usr/local/bin/*.sh | ||
|
||
COPY resources/custom.js /home/$NB_USER/.jupyter/custom/ | ||
COPY resources/jupyter_notebook_config.py /home/$NB_USER/.jupyter/tmp.py | ||
RUN cat /home/$NB_USER/.jupyter/tmp.py >> /home/$NB_USER/.jupyter/jupyter_notebook_config.py && rm /home/$NB_USER/.jupyter/tmp.py | ||
|
||
USER $NB_USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
define(['base/js/namespace'], function(Jupyter){ | ||
Jupyter._target = '_self'; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
c.NotebookApp.tornado_settings = { | ||
'headers': { | ||
'Content-Security-Policy': | ||
"frame-ancestors 'self'" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>{% block title %}Jupyter Notebook{% endblock %}</title> | ||
{% block favicon %}<link id="favicon" rel="shortcut icon" type="image/x-icon" href="{{static_url("base/images/favicon.ico") }}">{% endblock %} | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<link rel="stylesheet" href="{{static_url("components/jquery-ui/themes/smoothness/jquery-ui.min.css") }}" type="text/css" /> | ||
<link rel="stylesheet" href="{{static_url("components/jquery-typeahead/dist/jquery.typeahead.min.css") }}" type="text/css" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
{% block stylesheet %} | ||
<link rel="stylesheet" href="{{ static_url("style/style.min.css") }}" type="text/css"/> | ||
{% endblock %} | ||
<link rel="stylesheet" href="{{ base_url }}custom/custom.css" type="text/css" /> | ||
<script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script> | ||
<script src="{{static_url('components/preact/index.js')}}" type="text/javascript"></script> | ||
<script src="{{static_url('components/proptypes/index.js')}}" type="text/javascript"></script> | ||
<script src="{{static_url('components/preact-compat/index.js')}}" type="text/javascript"></script> | ||
<script src="{{static_url('components/requirejs/require.js') }}" type="text/javascript" charset="utf-8"></script> | ||
<script> | ||
require.config({ | ||
{% if version_hash %} | ||
urlArgs: "v={{version_hash}}", | ||
{% endif %} | ||
baseUrl: '{{static_url("", include_version=False)}}', | ||
paths: { | ||
'auth/js/main': 'auth/js/main.min', | ||
custom : '{{ base_url }}custom', | ||
nbextensions : '{{ base_url }}nbextensions', | ||
kernelspecs : '{{ base_url }}kernelspecs', | ||
underscore : 'components/underscore/underscore-min', | ||
backbone : 'components/backbone/backbone-min', | ||
jed: 'components/jed/jed', | ||
jquery: 'components/jquery/jquery.min', | ||
json: 'components/requirejs-plugins/src/json', | ||
text: 'components/requirejs-text/text', | ||
bootstrap: 'components/bootstrap/js/bootstrap.min', | ||
bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min', | ||
'jquery-ui': 'components/jquery-ui/jquery-ui.min', | ||
moment: 'components/moment/min/moment-with-locales', | ||
codemirror: 'components/codemirror', | ||
termjs: 'components/xterm.js/xterm', | ||
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead.min', | ||
}, | ||
map: { // for backward compatibility | ||
"*": { | ||
"jqueryui": "jquery-ui", | ||
} | ||
}, | ||
shim: { | ||
typeahead: { | ||
deps: ["jquery"], | ||
exports: "typeahead" | ||
}, | ||
underscore: { | ||
exports: '_' | ||
}, | ||
backbone: { | ||
deps: ["underscore", "jquery"], | ||
exports: "Backbone" | ||
}, | ||
bootstrap: { | ||
deps: ["jquery"], | ||
exports: "bootstrap" | ||
}, | ||
bootstraptour: { | ||
deps: ["bootstrap"], | ||
exports: "Tour" | ||
}, | ||
"jquery-ui": { | ||
deps: ["jquery"], | ||
exports: "$" | ||
} | ||
}, | ||
waitSeconds: 30, | ||
}); | ||
|
||
require.config({ | ||
map: { | ||
'*':{ | ||
'contents': '{{ contents_js_source }}', | ||
} | ||
} | ||
}); | ||
|
||
// error-catching custom.js shim. | ||
define("custom", function (require, exports, module) { | ||
try { | ||
var custom = require('custom/custom'); | ||
console.debug('loaded custom.js'); | ||
return custom; | ||
} catch (e) { | ||
console.error("error loading custom.js", e); | ||
return {}; | ||
} | ||
}) | ||
|
||
document.nbjs_translations = {{ nbjs_translations|safe }}; | ||
document.documentElement.lang = navigator.language.toLowerCase(); | ||
</script> | ||
|
||
{% block meta %} | ||
{% endblock %} | ||
|
||
</head> | ||
|
||
<body class="{% block bodyclasses %}{% endblock %}" | ||
{% block params %} | ||
{% if logged_in and token %} | ||
data-jupyter-api-token="{{token | urlencode}}" | ||
{% endif %} | ||
{% endblock params %} | ||
dir="ltr"> | ||
|
||
<noscript> | ||
<div id='noscript'> | ||
{% trans %}Jupyter Notebook requires JavaScript.{% endtrans %}<br> | ||
{% trans %}Please enable it to proceed. {% endtrans %} | ||
</div> | ||
</noscript> | ||
|
||
<div id="header"> | ||
<div id="header-container" class="container"> | ||
<div id="ipython_notebook" class="nav navbar-brand"><a href="{{default_url}} | ||
{%- if logged_in and token -%}?token={{token}}{%- endif -%}" title='{% trans %}dashboard{% endtrans %}'> | ||
{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %} | ||
</a></div> | ||
|
||
{% block headercontainer %} | ||
{% endblock %} | ||
|
||
</div> | ||
<div class="header-bar"></div> | ||
|
||
{% block header %} | ||
{% endblock %} | ||
</div> | ||
|
||
<div id="site"> | ||
{% block site %} | ||
{% endblock %} | ||
</div> | ||
|
||
{% block after_site %} | ||
{% endblock %} | ||
|
||
{% block script %} | ||
{% endblock %} | ||
|
||
<script type='text/javascript'> | ||
function _remove_token_from_url() { | ||
if (window.location.search.length <= 1) { | ||
return; | ||
} | ||
var search_parameters = window.location.search.slice(1).split('&'); | ||
for (var i = 0; i < search_parameters.length; i++) { | ||
if (search_parameters[i].split('=')[0] === 'token') { | ||
// remote token from search parameters | ||
search_parameters.splice(i, 1); | ||
var new_search = ''; | ||
if (search_parameters.length) { | ||
new_search = '?' + search_parameters.join('&'); | ||
} | ||
var new_url = window.location.origin + | ||
window.location.pathname + | ||
new_search + | ||
window.location.hash; | ||
window.history.replaceState({}, "", new_url); | ||
return; | ||
} | ||
} | ||
} | ||
_remove_token_from_url(); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
set -e | ||
|
||
. /usr/local/bin/start.sh jupyter notebook --no-browser --port 8888 --ip=* --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
set -e | ||
|
||
# set default ip to 0.0.0.0 | ||
if [[ "$NOTEBOOK_ARGS $@" != *"--ip="* ]]; then | ||
NOTEBOOK_ARGS="--ip=0.0.0.0 $NOTEBOOK_ARGS" | ||
fi | ||
|
||
# handle some deprecated environment variables | ||
# from DockerSpawner < 0.8. | ||
# These won't be passed from DockerSpawner 0.9, | ||
# so avoid specifying --arg=empty-string | ||
if [ ! -z "$NOTEBOOK_DIR" ]; then | ||
NOTEBOOK_ARGS="--notebook-dir='$NOTEBOOK_DIR' $NOTEBOOK_ARGS" | ||
fi | ||
if [ ! -z "$JPY_PORT" ]; then | ||
NOTEBOOK_ARGS="--port=$JPY_PORT $NOTEBOOK_ARGS" | ||
fi | ||
if [ ! -z "$JPY_USER" ]; then | ||
NOTEBOOK_ARGS="--user=$JPY_USER $NOTEBOOK_ARGS" | ||
fi | ||
if [ ! -z "$JPY_COOKIE_NAME" ]; then | ||
NOTEBOOK_ARGS="--cookie-name=$JPY_COOKIE_NAME $NOTEBOOK_ARGS" | ||
fi | ||
if [ ! -z "$JPY_BASE_URL" ]; then | ||
NOTEBOOK_ARGS="--base-url=$JPY_BASE_URL $NOTEBOOK_ARGS" | ||
fi | ||
if [ ! -z "$JPY_HUB_PREFIX" ]; then | ||
NOTEBOOK_ARGS="--hub-prefix=$JPY_HUB_PREFIX $NOTEBOOK_ARGS" | ||
fi | ||
if [ ! -z "$JPY_HUB_API_URL" ]; then | ||
NOTEBOOK_ARGS="--hub-api-url=$JPY_HUB_API_URL $NOTEBOOK_ARGS" | ||
fi | ||
if [ ! -z "$JUPYTER_ENABLE_LAB" ]; then | ||
NOTEBOOK_BIN="jupyter labhub" | ||
else | ||
NOTEBOOK_BIN=jupyterhub-singleuser | ||
fi | ||
|
||
. /usr/local/bin/start.sh $NOTEBOOK_BIN $NOTEBOOK_ARGS $@ |
Oops, something went wrong.