11FROM jupyter/minimal-notebook
22
3- # Install the packages
4- USER root
5- RUN apt-get update -y && \
6- apt-get upgrade -y && \
7- apt-get install -y \
8- gcc \
9- g++ \
10- make \
11- curl \
12- libgeos-dev \
13- libproj-dev \
14- git \
15- ssh \
16- libffi-dev \
17- libssl-dev \
18- python-pip \
19- python-cffi \
20- python-lxml \
21- python-pil \
22- python-numpy \
23- python-scipy \
24- python-pandas \
25- python-matplotlib \
26- python-seaborn \
27- python-concurrent.futures \
28- cython \
29- python-scikits-learn \
30- python-scikits.statsmodels \
31- python-skimage-lib \
32- pkg-config
33-
34- # Install GDAL from source
35- RUN curl -O http://download.osgeo.org/gdal/2.1.3/gdal-2.1.3.tar.gz && \
36- tar -xzf gdal-2.1.3.tar.gz
37-
38- WORKDIR gdal-2.1.3
39-
40- RUN ./configure && \
41- make -j$(nproc) && \
42- make install && \
43- ldconfig
44-
45- WORKDIR ../
46-
47- RUN rm -rf gdal-2.1.3.tar.gz && \
48- rm -rf gdal-2.1.3
49-
50- WORKDIR work
51-
523# Create Python2 environment
53- USER $NB_USER
544RUN conda create --yes -p $CONDA_DIR/envs/python2 python=2.7
555
6+ # Install GDAL
7+ # We use conda because it is the only way to get gdal working properly with ipython
8+ # Installing from a precompiled binary (e.g. using ubuntugis) results in a
9+ # mismatchedsqlite3 version between build and runtime.
10+ # Downloading and building results in the gdal vsicurl driver not working
11+ # (not sure why)
12+ RUN conda install -y -c conda-forge gdal=2.1.3
13+ RUN conda install -y --name python2 -c conda-forge gdal=2.1.3
14+
5615# Add pip2.7 shortcut and install Python2 packages
5716RUN ln -s $CONDA_DIR/envs/python2/bin/pip $CONDA_DIR/bin/pip2.7 && \
5817 pip2.7 install --upgrade pip && \
18+ pip2.7 install numpy>=1.13.1 && \
5919 pip2.7 install \
60- setuptools \
61- matplotlib \
62- scikit-image && \
63- pip2.7 install \
20+ geojsonio \
21+ geopandas \
6422 ipykernel \
65- pyproj \
66- ipywidgets \
6723 ipyleaflet \
24+ ipywidgets \
25+ matplotlib \
6826 numpy \
69- shapely \
70- --no-binary :all: rasterio==1.0a9 \
71- geopandas \
72- tqdm \
27+ opencv-python==3.3.0.10 \
7328 planet \
7429 pygdal==2.1.3.3 \
75- geojsonio \
76- scikit-learn && \
77- pip2.7 install \
78- opencv-python==3.3.0.10
30+ pyproj \
31+ rasterio==1.0a12 \
32+ setuptools \
33+ scikit-image \
34+ shapely \
35+ scikit-learn \
36+ tqdm
37+
38+ # Install tippecanoe (required for label-maker)
39+ USER root
40+ RUN apt-get update && apt-get install -y \
41+ build-essential \
42+ git \
43+ libsqlite3-dev \
44+ zlib1g-dev
45+
46+ RUN git clone https://github.com/mapbox/tippecanoe.git
47+ WORKDIR tippecanoe
48+ RUN make && make install
49+ WORKDIR ..
50+
51+
52+ # Install dependencies for pycurl, a dependency of label-maker
53+ RUN apt-get update && apt-get install -y libcurl4-openssl-dev
7954
8055# Add pip shortcut and install Python3 packages
56+ USER $NB_USER
8157RUN pip install --upgrade pip && \
82- pip install matplotlib && \
83- pip install scikit-image && \
58+ pip install numpy>=1.13.1 && \
8459 pip install \
85- pyproj \
86- ipywidgets \
60+ geojson \
61+ geopandas \
8762 ipyleaflet \
63+ ipywidgets \
64+ label-maker==0.3.1 \
65+ matplotlib \
8866 numpy \
89- shapely \
90- --no-binary :all: rasterio==1.0a9 \
91- geopandas \
92- tqdm \
67+ opencv-python==3.3.0.10 \
9368 planet \
9469 pygdal==2.1.3.3 \
95- geojsonio && \
96- pip install \
97- opencv-python==3.3.0.10
70+ pyproj \
71+ rasterio==1.0a12 \
72+ scikit-image \
73+ shapely \
74+ tqdm
9875
9976# Activate Python2 kernel globally and upon kernel launch.
10077USER root
@@ -108,11 +85,9 @@ USER $NB_USER
10885RUN jupyter nbextension enable --py widgetsnbextension --sys-prefix && \
10986 jupyter nbextension enable --py --sys-prefix ipyleaflet
11087
88+ # Clean up
11189USER root
112- RUN apt-get remove --yes g++ gcc ssh git make curl && \
113- conda clean --yes --all && \
114- apt-get clean autoclean && \
115- apt-get autoremove -y && \
116- rm -rf /var/lib/{apt,dpkg,cache,log}/
90+ RUN rm -rf /var/lib/{apt,dpkg,cache,log}/
11791
92+ WORKDIR work
11893USER $NB_USER
0 commit comments