forked from xirlogirl/notebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
112 lines (98 loc) · 2.61 KB
/
Dockerfile
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
FROM jupyter/minimal-notebook
# Install the packages
USER root
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y \
gcc \
g++ \
make \
curl \
libgeos-dev \
git \
ssh \
libffi-dev \
libssl-dev \
python-pip \
python-cffi \
python-lxml \
python-pil \
python-numpy \
python-scipy \
python-pandas \
python-matplotlib \
python-seaborn \
python-concurrent.futures \
cython \
python-scikits-learn \
python-scikits.statsmodels \
python-skimage-lib \
pkg-config
# Install GDAL from source
RUN curl -O http://download.osgeo.org/gdal/2.1.3/gdal-2.1.3.tar.gz && \
tar -xzf gdal-2.1.3.tar.gz
WORKDIR gdal-2.1.3
RUN ./configure && \
make -j$(nproc) && \
make install && \
ldconfig
WORKDIR ../
RUN rm -rf gdal-2.1.3.tar.gz && \
rm -rf gdal-2.1.3
WORKDIR work
# Create Python2 environment
USER $NB_USER
RUN conda create --yes -p $CONDA_DIR/envs/python2 python=2.7
# Add pip2.7 shortcut and install Python2 packages
RUN ln -s $CONDA_DIR/envs/python2/bin/pip $CONDA_DIR/bin/pip2.7 && \
pip install --upgrade pip && \
pip2.7 install \
setuptools \
matplotlib \
scikit-image && \
pip2.7 install \
ipykernel \
pyproj \
ipywidgets \
ipyleaflet \
numpy \
shapely \
--no-binary :all: rasterio \
geopandas \
tqdm \
planet \
pygdal==2.1.3.3 \
geojsonio
# Add pip shortcut and install Python3 packages
RUN pip install --upgrade pip && \
pip install matplotlib && \
pip install scikit-image && \
pip install \
pyproj \
ipywidgets \
ipyleaflet \
numpy \
shapely \
--no-binary :all: rasterio \
geopandas \
tqdm \
planet \
pygdal==2.1.3.3 \
geojsonio
# Activate Python2 kernel globally and upon kernel launch.
USER root
RUN pip install kernda --no-cache && \
$CONDA_DIR/envs/python2/bin/python -m ipykernel install && \
kernda -o -y /usr/local/share/jupyter/kernels/python2/kernel.json && \
pip uninstall kernda -y
# Enable Jupyter extentions
USER $NB_USER
RUN jupyter nbextension enable --py widgetsnbextension --sys-prefix && \
jupyter nbextension enable --py --sys-prefix ipyleaflet
USER root
RUN apt-get remove --yes g++ gcc ssh git make curl && \
conda clean --yes --all && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/{apt,dpkg,cache,log}/
USER $NB_USER