2024-05-27 02:30:44 -04:00
|
|
|
FROM debian:bookworm-slim as builder
|
2017-10-31 23:31:32 -04:00
|
|
|
ARG DOCKER_TAG
|
2019-01-17 19:14:58 -05:00
|
|
|
ARG BUILD_CONCURRENCY
|
2017-10-31 23:31:32 -04:00
|
|
|
RUN mkdir -p /src && mkdir -p /opt
|
2022-02-16 16:18:28 -05:00
|
|
|
|
|
|
|
RUN apt-get update && \
|
2022-08-24 12:13:49 -04:00
|
|
|
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
|
2024-05-27 02:30:44 -04:00
|
|
|
libzip-dev libboost1.81-all-dev lua5.4 liblua5.4-dev pkg-config -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
|
2022-08-24 12:13:49 -04:00
|
|
|
|
|
|
|
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
|
|
|
ldconfig /usr/local/lib && \
|
2024-05-27 02:30:44 -04:00
|
|
|
git clone --branch v2021.12.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \
|
2022-08-24 12:13:49 -04:00
|
|
|
cd oneTBB && \
|
|
|
|
mkdir build && \
|
|
|
|
cd build && \
|
|
|
|
cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \
|
|
|
|
cmake --build . && \
|
|
|
|
cmake --install .
|
2022-02-16 16:18:28 -05:00
|
|
|
|
2017-10-31 23:31:32 -04:00
|
|
|
COPY . /src
|
|
|
|
WORKDIR /src
|
2017-05-29 06:08:44 -04:00
|
|
|
|
2022-08-24 12:13:49 -04:00
|
|
|
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
2024-05-27 02:30:44 -04:00
|
|
|
export CXXFLAGS="-Wno-array-bounds -Wno-uninitialized" && \
|
2022-08-16 13:26:21 -04:00
|
|
|
echo "Building OSRM ${DOCKER_TAG}" && \
|
2017-04-28 10:20:37 -04:00
|
|
|
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
2017-05-05 09:55:48 -04:00
|
|
|
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
2017-10-31 23:31:32 -04:00
|
|
|
mkdir -p build && \
|
2017-03-10 07:00:06 -05:00
|
|
|
cd build && \
|
2017-05-29 06:08:44 -04:00
|
|
|
BUILD_TYPE="Release" && \
|
|
|
|
ENABLE_ASSERTIONS="Off" && \
|
|
|
|
BUILD_TOOLS="Off" && \
|
|
|
|
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
|
|
|
|
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
|
|
|
|
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
|
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
|
2017-03-10 07:00:06 -05:00
|
|
|
make -j${NPROC} install && \
|
|
|
|
cd ../profiles && \
|
|
|
|
cp -r * /opt && \
|
|
|
|
strip /usr/local/bin/* && \
|
2023-04-15 10:27:51 -04:00
|
|
|
rm -rf /src
|
2017-10-31 23:31:32 -04:00
|
|
|
|
2022-08-24 12:13:49 -04:00
|
|
|
|
2017-10-31 23:31:32 -04:00
|
|
|
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
|
|
|
|
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
|
2024-05-27 02:30:44 -04:00
|
|
|
FROM debian:bookworm-slim as runstage
|
2022-08-24 12:13:49 -04:00
|
|
|
|
|
|
|
COPY --from=builder /usr/local /usr/local
|
|
|
|
COPY --from=builder /opt /opt
|
|
|
|
|
2018-11-06 17:02:54 -05:00
|
|
|
RUN apt-get update && \
|
2024-05-27 02:30:44 -04:00
|
|
|
apt-get install -y --no-install-recommends libboost-program-options1.81.0 libboost-regex1.81.0 \
|
|
|
|
libboost-date-time1.81.0 libboost-chrono1.81.0 libboost-filesystem1.81.0 \
|
|
|
|
libboost-iostreams1.81.0 libboost-system1.81.0 libboost-thread1.81.0 \
|
2022-08-28 18:03:03 -04:00
|
|
|
expat liblua5.4-0 && \
|
2022-08-24 12:13:49 -04:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
# add /usr/local/lib to ldconfig to allow loading libraries from there
|
|
|
|
ldconfig /usr/local/lib
|
|
|
|
|
2019-01-11 19:42:50 -05:00
|
|
|
RUN /usr/local/bin/osrm-extract --help && \
|
|
|
|
/usr/local/bin/osrm-routed --help && \
|
|
|
|
/usr/local/bin/osrm-contract --help && \
|
|
|
|
/usr/local/bin/osrm-partition --help && \
|
|
|
|
/usr/local/bin/osrm-customize --help
|
2022-08-24 12:13:49 -04:00
|
|
|
|
2017-10-31 23:31:32 -04:00
|
|
|
WORKDIR /opt
|
2017-03-10 07:00:06 -05:00
|
|
|
|
|
|
|
EXPOSE 5000
|