-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
66 lines (56 loc) · 1.99 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM ubuntu:focal
ENV MAP_URL=https://raw.githubusercontent.com/KevinLADLee/KevinLADLee.github.io/master/hongkong.osm.pbf
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends -y build-essential sudo curl wget apt-transport-https ca-certificates locales git vim \
&& rm -rf /var/lib/apt/lists/* /tmp/*
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
libboost-all-dev \
libxml2-dev \
ffmpeg \
cmake \
libzip-dev \
libtbb-dev \
ccache \
gdal-bin \
libreadline-dev \
libbz2-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/* /tmp/*
ADD . /opt/mod-abm-2.0
WORKDIR /opt
RUN mkdir osrm \
&& cd osrm \
&& curl -R -O http://www.lua.org/ftp/lua-5.3.6.tar.gz \
&& tar zxf lua-5.3.6.tar.gz \
&& cd lua-5.3.6 \
&& make linux test \
&& make install \
&& cd .. \
&& rm lua-5.3.6.tar.gz
RUN if [ "x$(nproc)" = "x1" ] ; then export USE_PROC=1 ; else export USE_PROC=$(($(nproc)/2)) ; fi \
&& cd osrm \
&& git clone https://github.com/Project-OSRM/osrm-backend.git \
&& cd osrm-backend \
&& mkdir build \
&& cd build \
&& cmake .. \
&& cmake --build . -j${USE_PROC} \
&& cmake --build . --target install
RUN cd osrm \
&& mkdir map \
&& cd map \
&& wget -qc $MAP_URL \
&& cd .. \
&& ./osrm-backend/build/osrm-extract ./map/hongkong.osm.pbf -p osrm-backend/profiles/car.lua \
&& ./osrm-backend/build/osrm-partition ./map/hongkong.osrm \
&& ./osrm-backend/build/osrm-customize ./map/hongkong.osrm
RUN if [ "x$(nproc)" = "x1" ] ; then export USE_PROC=1 ; else export USE_PROC=$(($(nproc)/2)) ; fi && \
cd /opt/mod-abm-2.0 \
&& cmake -S . -B build \
&& cmake --build build -j${USE_PROC}
# Usage:
# docker run -it --rm --name=mod mod-able:latest bash
# cd /opt/mod-abm-2.0
# ./build/main "./config/platform_demo.yml" "../osrm/map/hongkong.osrm" "./config/demand_demo.yml" 1