Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.