valhalla/Dockerfile

90 lines
4.1 KiB
Docker

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/*
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 checkout 3.0.3 && \
git submodule update --init --recursive
ADD geos-3.7.diff /home
ADD private-access.diff /home
RUN cd /home/valhalla/valhalla && \
patch -p1 < /home/geos-3.7.diff && \
patch -p1 < /home/private-access.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
RUN dpkg -l | grep libgeos-3 | awk '{print $2}' >> /root/pkg.lst
FROM debian:sid AS run
MAINTAINER Vitaliy Filippov <vitalif@mail.ru>
ADD etc /etc
COPY --from=build /root/pkg.lst /root/
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 `cat /root/pkg.lst` 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/
RUN cd / && tar -xf /home/valhalla.tar && tar -xf /home/prime_server.tar && rm /home/*.tar && ldconfig
ADD home /home
RUN cd /home && valhalla_build_config \
--service-limits-bicycle-max-matrix-locations 10000 \
--service-limits-bicycle-max-matrix-distance 500000 \
--service-limits-motor-scooter-max-matrix-locations 10000 \
--service-limits-motor-scooter-max-matrix-distance 500000 \
--service-limits-auto-max-matrix-locations 10000 \
--service-limits-auto-max-matrix-distance 5000000 \
--service-limits-transit-max-matrix-locations 10000 \
--service-limits-transit-max-matrix-distance 500000 \
--service-limits-hov-max-matrix-locations 10000 \
--service-limits-hov-max-matrix-distance 5000000 \
--service-limits-pedestrian-max-matrix-locations 10000 \
--service-limits-pedestrian-max-matrix-distance 250000 \
--service-limits-auto-shorter-max-matrix-locations 10000 \
--service-limits-auto-shorter-max-matrix-distance 5000000 \
--service-limits-truck-max-matrix-locations 10000 \
--service-limits-truck-max-matrix-distance 5000000 \
--service-limits-motorcycle-max-matrix-locations 10000 \
--service-limits-motorcycle-max-matrix-distance 500000 \
--service-limits-bus-max-matrix-locations 10000 \
--service-limits-bus-max-matrix-distance 5000000 \
--mjolnir-tile-dir /home/valhalla/valhalla_tiles \
--mjolnir-tile-extract /home/valhalla/valhalla_tiles.tar \
--mjolnir-timezone /home/valhalla/valhalla_tiles/timezones.sqlite \
--mjolnir-admin /home/valhalla/valhalla_tiles/admins.sqlite > valhalla.json
CMD /home/start.sh
EXPOSE 8002