Skip to content

Instantly share code, notes, and snippets.

@jwhiting
Created September 10, 2019 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwhiting/05d20afab735355fb0c3972f3f8ad910 to your computer and use it in GitHub Desktop.
Save jwhiting/05d20afab735355fb0c3972f3f8ad910 to your computer and use it in GitHub Desktop.
Dockerfile for python3 with s2geometry bindings
FROM python:3.7
WORKDIR /usr/src/app
# deps for s2 geometry lib
RUN apt-get update
RUN apt-get install -y cmake libgflags-dev libgoogle-glog-dev libgtest-dev libssl-dev swig
# get the repo and setup the build process. note the CMAKE_INSTALL_PREFIX:PATH config
# is not in google's instructions for how to build the library, but otherwise python
# doesn't see the libs2.so file on import.
RUN git clone https://github.com/google/s2geometry.git
WORKDIR /usr/src/app/s2geometry
RUN mkdir build
WORKDIR /usr/src/app/s2geometry/build
RUN cmake -DWITH_GFLAGS=ON -WITH_GTEST=ON -DGTEST_ROOT=/usr/src/gtest -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
RUN make
RUN make test
RUN make install
# changing the CMAKE_INSTALL_PREFIX above also moved the module to a place
# python cannot find. add that location to python's module path.
ENV PYTHONPATH=/usr/lib/python3.7/site-packages
WORKDIR /usr/src/app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment