Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker, Jp notebook configurations #15

Merged
merged 12 commits into from
Feb 16, 2018
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.env
*.pyc
__pycache__/
ptenv/
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM kuanb/peartree

RUN mkdir /code && \
pip install numpy==1.14.0 scipy==1.0.0

WORKDIR /code

COPY requirements_dev.txt /code/
RUN pip install -r requirements_dev.txt

COPY requirements.txt /code/
RUN pip install -r requirements.txt
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,21 @@ test:
PYTHONPATH=. MPLBACKEND="agg" coverage run --source peartree -m py.test --verbose

performance:
PYTHONPATH=. MPLBACKEND="agg" pytest profiler/test_graph_assembly.py -s
PYTHONPATH=. MPLBACKEND="agg" pytest profiler/test_graph_assembly.py -s

notebook:
docker-compose build
mkdir -p ./notebooks
docker-compose up notebook

docker-clean:
docker network prune --force
docker volume prune --force
docker image prune --force

install-graph-tool:
sed -i -e '$$a\
deb http://downloads.skewed.de/apt/stretch stretch main\
deb-src http://downloads.skewed.de/apt/stretch stretch main' /etc/apt/sources.list && \
apt-get update && \
apt-get install python3-graph-tool
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

version: "3"

services:

# Jupyter Notebook
notebook:
build:
context: .
env_file: .env
command: jupyter notebook --config jupyter_notebook_config.py
volumes:
- .:/code
- /tmp:/tmp
ports:
- "9797:9797"
92 changes: 92 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
FROM python:3.6-stretch

RUN mkdir -p /provisioning
WORKDIR /provisioning

# Install OS dependencies
RUN apt-get update && apt-get install -y \
build-essential \
dialog \
curl \
less \
nano \
unzip \
vim \
gcc \
libgeos-dev \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

# Get libgeos for Python Shapely package
# https://trac.osgeo.org/geos/
ARG GEOS_VERSION=3.6.2
RUN echo "Installing GEOS libraries..." && \
mkdir -p /provisioning/geos && \
cd /provisioning/geos && \
curl -# -O http://download.osgeo.org/geos/geos-${GEOS_VERSION}.tar.bz2 && \
tar -xjf geos-${GEOS_VERSION}.tar.bz2 && \
cd geos-${GEOS_VERSION} && \
./configure && \
make -j$(python -c 'import multiprocessing; print(multiprocessing.cpu_count())') && \
make install && \
ldconfig -v && \
rm -rf /provisioning/geos*

# Get ESRI FileGDB libraries for Fiona/Geopandas Python packages
# http://appsforms.esri.com/products/download/
ARG FILEGDB_VERSION=1_5
RUN echo "Installing ESRI FileGDB libraries..." && \
mkdir -p /provisioning/filegdb && \
curl -L -o filegdb_api_${FILEGDB_VERSION}-64.tar.gz https://www.dropbox.com/s/xi11vshwt9uojsy/FileGDB_API_1_5_64gcc51.tar.gz?dl=1 && \
tar -zxvf filegdb_api_${FILEGDB_VERSION}-64.tar.gz && \
cp -r FileGDB_API-64gcc51/lib/* /usr/local/lib && \
cp -r FileGDB_API-64gcc51/include/* /usr/local/include && \
ldconfig -v && \
rm -rf /provisioning/filegdb* /provisioning/FileGDB*

# Compile GDAL with FileGDB support for Fiona/Geopandas Python packages
RUN echo "Installing GDAL libraries..." && \
mkdir -p /provisioning/gdal && \
cd /provisioning/gdal && \
curl -# -o gdal-2.2.1.tar.gz http://download.osgeo.org/gdal/2.2.1/gdal-2.2.1.tar.gz && \
tar -zxvf gdal-2.2.1.tar.gz && \
cd /provisioning/gdal/gdal-2.2.1 && \
./configure --prefix=/usr/ --with-python --with-fgdb && \
make -j$(python -c 'import multiprocessing; print(multiprocessing.cpu_count())') && \
make install && \
rm -rf /provisioning/gdal*

RUN echo "Installing Spatial Index library..." && \
mkdir -p /provisioning/spatialindex && \
cd /provisioning/spatialindex && \
curl -# -O http://download.osgeo.org/libspatialindex/spatialindex-src-1.8.5.tar.gz && \
tar -xzf spatialindex-src-1.8.5.tar.gz && \
cd spatialindex-src-1.8.5 && \
./configure --prefix=/usr/local && \
make -j$(python -c 'import multiprocessing; print(multiprocessing.cpu_count())') && \
make install && \
ldconfig && \
rm -rf /provisioning/spatialindex*

RUN echo "Installing Proj4 library..." && \
mkdir -p /provisioning/proj4 && \
cd /provisioning/proj4 && \
curl -# -O http://download.osgeo.org/proj/proj-4.9.3.tar.gz && \
tar -xzf proj-4.9.3.tar.gz && \
cd proj-4.9.3 && \
./configure && \
make -j$(python -c 'import multiprocessing; print(multiprocessing.cpu_count())') && \
make install && \
ldconfig -v && \
rm -rf /provisioning/proj4

# basemap (incorrectly) requires numpy to be installed *before* installing it
RUN pip install --upgrade numpy && \
echo "Installing Basemap plotting library..." && \
mkdir -p /provisioning/matplotlib-basemap && \
cd /provisioning/matplotlib-basemap && \
curl -# -o basemap-1.0.7rel.tar.gz https://codeload.github.com/matplotlib/basemap/tar.gz/v1.0.7rel && \
tar -xzf basemap-1.0.7rel.tar.gz && \
cd basemap-1.0.7rel && \
python setup.py install && \
rm -rf /provisioning/matplotlib-basemap
Loading