Skip to content
Daniel Patterson edited this page Sep 24, 2016 · 12 revisions

These Dockerfile recipes show how to build OSRM under various Linux distributions.

Alpine Linux

Final image size: ~30MB Version info: created on 2016-09-23 against OSRM master

FROM alpine
RUN mkdir /opt
WORKDIR /opt
RUN apk update && \
    apk upgrade && \
    apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.1-dev && \
    wget https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb2017_20160722oss_src.tgz && \
    gzip -cd tbb2017_20160722oss_src.tgz | tar xvf - && \
    cd tbb2017_20160722oss && \
    sed -e '/MALLOC_UNIXLIKE_OVERLOAD_ENABLED/ s/__linux__/0/' -i src/tbbmalloc/proxy.h && \
    make && \
    mkdir -p /usr/local/include/tbb && \
    cp -vr include/tbb/* /usr/local/include/tbb && \
    cp build/$(cd /opt/tbb2017_20160722oss && make info | grep tbb_build_prefix | cut -f 2 -d =)_release/lib* /usr/local/lib && \
    cd /opt && \
    git clone https://github.com/mapbox/luabind.git && \
    cd luabind && \
    mkdir build && \
    cd build && \
    cmake .. && \
    make && \
    make install && \
    cd /opt && \
    wget -O stxxl-1.4.1.tar.gz http://sourceforge.net/projects/stxxl/files/stxxl/1.4.1/stxxl-1.4.1.tar.gz/download && \
    gzip -cd stxxl-1.4.1.tar.gz | tar xvf - && \
    cd stxxl-1.4.1 && \
    mkdir build && \
    cd build && \
    cmake -DCMAKE_BUILD_TYPE=Release .. && \
    make && \
    make install && \
    cd /opt && \
    git clone https://github.com/Project-OSRM/osrm-backend.git && \
    cd osrm-backend && \
    sed -e 's/-D_FORTIFY_SOURCE/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE/g' -i CMakeLists.txt && \
    mkdir build && \
    cd build && \
    cmake -DLUABIND_INCLUDE_DIR=/usr/local/include .. && \
    make install && \
    strip /usr/local/bin/* && \
    strip /usr/local/lib/libtbb*.so.2 && \
    rm /usr/local/lib/libstxxl* /usr/local/lib/libluabind* && \
    cd /opt && \
    apk del boost-dev && \
    apk del g++ cmake libc-dev expat-dev zlib-dev bzip2-dev lua5.1-dev git make gcc && \
    apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.1 expat && \
    rm -rf /opt/* /usr/local/bin/stxxl_tool /usr/local/lib/libosrm*

Clone this wiki locally