Skip to content

Instantly share code, notes, and snippets.

@perrygeo
Last active February 27, 2023 12:00
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save perrygeo/1eea522b283baf91dbca497150155695 to your computer and use it in GitHub Desktop.
Save perrygeo/1eea522b283baf91dbca497150155695 to your computer and use it in GitHub Desktop.
Minimal debian image with Python 3.6 and geo python tools
FROM python:3.6-slim-stretch
ADD requirements.txt /tmp/requirements.txt
RUN apt-get update && \
apt-get install -y \
build-essential \
make \
gcc \
locales \
libgdal20 libgdal-dev && \
python -m pip install numpy cython --no-binary numpy,cython && \
python -m pip install \
"rasterio>=1.0a12" fiona shapely \
--pre --no-binary rasterio,fiona,shapely && \
python -m pip install -r /tmp/requirements.txt && \
python -m pip uninstall -y cython && \
rm -r /root/.cache/pip && \
apt-get remove -y --purge libgdal-dev make gcc build-essential && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
RUN dpkg-reconfigure locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8
ENV LC_ALL C.UTF-8
CMD ["/bin/python"]
default: image test notebook
.PHONY: image shell
image:
docker build --tag slimpy:latest .
test:
docker run -it --rm slimpy:latest python -c "import rasterio, fiona, shapely, numpy, sys; print('Python:', sys.version); print('Rasterio:', rasterio.__version__); print('Fiona:', fiona.__version__); print('Shapely:', shapely.__version__); print('Numpy', numpy.__version__);"
shell: image
docker run -it --rm slimpy:latest /bin/bash
notebook:
docker run -it --rm \
-p 0.0.0.0:8888:8888 \
--rm \
--interactive \
--tty \
--volume $(shell pwd)/notebooks/:/notebooks \
slimpy:latest /bin/bash -c "cd /notebooks && jupyter notebook --ip=0.0.0.0 --allow-root"
rasterio>=1.0a12
fiona
shapely
pandas
geopandas
pyproj
mapbox
rasterstats
mapboxgl
jupyter
mercantile
scipy
scikit-learn
seaborn
statsmodels
ggplot
@johnniehard
Copy link

Thank you! This was exactly what I needed. I made a fork that uses docker-compose in place of the Makefile, here: https://gist.github.com/johnniehard/90a7f4fc1b0701360f67ba77b9b50c7a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment