Skip to content

Commit

Permalink
Merge 25ba10d into d101c00
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanb committed Jan 7, 2018
2 parents d101c00 + 25ba10d commit 510273e
Show file tree
Hide file tree
Showing 9 changed files with 809 additions and 3 deletions.
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 python:3.6-stretch

RUN mkdir /code && \
pip install numpy==1.12.1 --src /usr/local/src

WORKDIR /code

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

COPY requirements.txt /code/
RUN pip install -r requirements.txt
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@ 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
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_4
RUN echo "Installing ESRI FileGDB libraries..." && \
mkdir -p /provisioning/filegdb && \
curl -# -o filegdb_api_${FILEGDB_VERSION}-64.tar.gz https://www.dropbox.com/s/dti2x6ydibyfs68/filegdb_api_1_2-64.tar.gz?dl=1 && \
tar -zxvf filegdb_api_${FILEGDB_VERSION}-64.tar.gz && \
cp -r FileGDB_API-64/lib/* /usr/local/lib && \
cp -r FileGDB_API-64/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

0 comments on commit 510273e

Please sign in to comment.