Valhalla source build in Docker
commit
afe357c9b6
|
@ -0,0 +1,62 @@
|
||||||
|
FROM debian:sid AS build
|
||||||
|
MAINTAINER Vitaliy Filippov <vitalif@mail.ru>
|
||||||
|
|
||||||
|
ADD etc /etc
|
||||||
|
|
||||||
|
# ca-certificates & gnupg2 needed to pull nodejs from nodesource repo
|
||||||
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
|
||||||
|
less wget sudo curl unzip git mc ca-certificates gnupg2 \
|
||||||
|
build-essential cmake zlib1g-dev libprotobuf-dev libcurl4-openssl-dev pkg-config protobuf-compiler libzmq3-dev libczmq-dev \
|
||||||
|
libgeos-dev libgeos++-dev liblua5.2-dev libspatialite-dev libsqlite3-dev lua5.2 \
|
||||||
|
libboost-date-time-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev libboost-python-dev && \
|
||||||
|
(curl -L https://deb.nodesource.com/setup_8.x | bash -) && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs gyp && \
|
||||||
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ADD geos-3.7.diff /home
|
||||||
|
|
||||||
|
RUN mkdir /home/valhalla && \
|
||||||
|
cd /home/valhalla && \
|
||||||
|
git clone https://github.com/kevinkreiser/prime_server && \
|
||||||
|
cd /home/valhalla/prime_server && \
|
||||||
|
git submodule update --init --recursive && \
|
||||||
|
mkdir build && cd build && cmake .. && make -j4 install && \
|
||||||
|
tar -cf /home/valhalla/prime_server.tar -T install_manifest.txt
|
||||||
|
|
||||||
|
RUN cd /home/valhalla && \
|
||||||
|
git clone https://github.com/valhalla/valhalla && \
|
||||||
|
cd /home/valhalla/valhalla && \
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
RUN cd /home/valhalla/valhalla && \
|
||||||
|
patch -p1 < /home/geos-3.7.diff && \
|
||||||
|
npm install node-cmake && \
|
||||||
|
cd /home/valhalla/valhalla && mkdir build && cd build && cmake .. && make -j4 install && \
|
||||||
|
tar -cf /home/valhalla/valhalla.tar -T install_manifest.txt && \
|
||||||
|
cd .. && tar -cf /home/valhalla/node-valhalla.tar lib package.json
|
||||||
|
|
||||||
|
FROM debian:sid AS run
|
||||||
|
MAINTAINER Vitaliy Filippov <vitalif@mail.ru>
|
||||||
|
|
||||||
|
ADD etc /etc
|
||||||
|
|
||||||
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
|
||||||
|
less wget sudo curl unzip git mc \
|
||||||
|
zlib1g libprotobuf17 libprotobuf-lite17 libcurl4 libzmq5 libczmq4 libgeos-3.7.0 libspatialite7 libsqlite3-0 lua5.2 liblua5.2-0 \
|
||||||
|
libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-system1.67.0 libboost-program-options1.67.0 python && \
|
||||||
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY --from=build /home/valhalla/node-valhalla.tar /home/valhalla/valhalla.tar /home/valhalla/prime_server.tar /home/valhalla/
|
||||||
|
|
||||||
|
RUN cd / && tar -xf /home/valhalla/valhalla.tar && tar -xf /home/valhalla/prime_server.tar && rm /home/valhalla/*.tar && ldconfig
|
||||||
|
|
||||||
|
ADD home /home
|
||||||
|
|
||||||
|
RUN cd /home/valhalla && valhalla_build_config --mjolnir-tile-dir ${PWD}/valhalla_tiles \
|
||||||
|
--mjolnir-tile-extract ${PWD}/valhalla_tiles.tar \
|
||||||
|
--mjolnir-timezone ${PWD}/valhalla_tiles/timezones.sqlite \
|
||||||
|
--mjolnir-admin ${PWD}/valhalla_tiles/admins.sqlite > valhalla.json
|
||||||
|
|
||||||
|
CMD /home/start.sh
|
||||||
|
|
||||||
|
EXPOSE 8002
|
|
@ -0,0 +1,13 @@
|
||||||
|
## Building
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t valhalla .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -it -d --restart always \
|
||||||
|
-v /home/test/russia-latest.osm.pbf:/home/valhalla/data.osm.pbf \
|
||||||
|
--name valhalla -p 8002:8002 valhalla
|
||||||
|
```
|
|
@ -0,0 +1,4 @@
|
||||||
|
APT::Install-Suggests false;
|
||||||
|
APT::Install-Recommends false;
|
||||||
|
Acquire::Retries 5;
|
||||||
|
Binary::apt::APT::Keep-Downloaded-Packages "false";
|
|
@ -0,0 +1,26 @@
|
||||||
|
diff --git a/src/mjolnir/valhalla_build_admins.cc b/src/mjolnir/valhalla_build_admins.cc
|
||||||
|
index 3f675a231..cc211ce42 100644
|
||||||
|
--- a/src/mjolnir/valhalla_build_admins.cc
|
||||||
|
+++ b/src/mjolnir/valhalla_build_admins.cc
|
||||||
|
@@ -143,7 +143,9 @@ int polygondata_comparearea(const void* vp1, const void* vp2) {
|
||||||
|
std::vector<std::string> GetWkts(std::unique_ptr<Geometry>& mline) {
|
||||||
|
std::vector<std::string> wkts;
|
||||||
|
|
||||||
|
-#if 3 == GEOS_VERSION_MAJOR && 6 <= GEOS_VERSION_MINOR
|
||||||
|
+#if 3 == GEOS_VERSION_MAJOR && 7 <= GEOS_VERSION_MINOR
|
||||||
|
+ GeometryFactory::Ptr gf = GeometryFactory::create();
|
||||||
|
+#elif 3 == GEOS_VERSION_MAJOR && 6 <= GEOS_VERSION_MINOR
|
||||||
|
GeometryFactory::unique_ptr gf = GeometryFactory::create();
|
||||||
|
#else
|
||||||
|
std::unique_ptr<GeometryFactory> gf(new GeometryFactory());
|
||||||
|
@@ -422,7 +424,9 @@ void BuildAdminFromPBF(const boost::property_tree::ptree& pt,
|
||||||
|
uint32_t count = 0;
|
||||||
|
uint64_t nodeid;
|
||||||
|
bool has_data;
|
||||||
|
-#if 3 == GEOS_VERSION_MAJOR && 6 <= GEOS_VERSION_MINOR
|
||||||
|
+#if 3 == GEOS_VERSION_MAJOR && 7 <= GEOS_VERSION_MINOR
|
||||||
|
+ GeometryFactory::Ptr gf = GeometryFactory::create();
|
||||||
|
+#elif 3 == GEOS_VERSION_MAJOR && 6 <= GEOS_VERSION_MINOR
|
||||||
|
GeometryFactory::unique_ptr gf = GeometryFactory::create();
|
||||||
|
#else
|
||||||
|
std::unique_ptr<GeometryFactory> gf(new GeometryFactory());
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /home/valhalla
|
||||||
|
|
||||||
|
if [ valhalla_tiles.tar -ot data.osm.pbf ]; then
|
||||||
|
rm -rf valhalla_tiles
|
||||||
|
valhalla_build_tiles -c valhalla.json data.osm.pbf
|
||||||
|
find valhalla_tiles | sort -n | tar cf valhalla_tiles.tar --no-recursion -T -
|
||||||
|
fi
|
||||||
|
|
||||||
|
valhalla_service valhalla.json 1
|
Loading…
Reference in New Issue