Created
September 10, 2019 21:42
-
-
Save jwhiting/05d20afab735355fb0c3972f3f8ad910 to your computer and use it in GitHub Desktop.
Dockerfile for python3 with s2geometry bindings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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