From 6d2353c3027b5c3fbcbe2c6895dd282ff346da43 Mon Sep 17 00:00:00 2001 From: Johan Uhle Date: Mon, 29 May 2017 12:08:44 +0200 Subject: [PATCH] Allow docker image with assertions (#4016) --- README.md | 9 +++++++++ docker/Dockerfile | 27 ++++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 00d84260d..6b8897677 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,15 @@ In case Docker complains about not being able to connect to the Docker daemon ma After adding yourself to the `docker` group make sure to log out and back in again with your terminal. +We support the following images on Docker Cloud: + +Name | Description +-----|------ +`latest` | `master` compiled with release flag +`latest-assertions` | `master` compiled with with release flag, assertions enabled and debug symbols +`latest-debug` | `master` compiled with debug flag +`` | specific tag compiled with release flag +`-debug` | specific tag compiled with debug flag ### Building from Source diff --git a/docker/Dockerfile b/docker/Dockerfile index 1d761b7d6..0c4ba0215 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,15 +1,9 @@ FROM alpine:3.5 -ARG DOCKER_TAG - -RUN mkdir /src -COPY . /src - RUN mkdir /opt WORKDIR /opt + RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ - case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; *) BUILD_TYPE="Release";; esac && \ - \ echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ apk update && \ apk upgrade && \ @@ -23,15 +17,26 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ cd build && \ cmake -DCMAKE_BUILD_TYPE=Release .. && \ make -j${NPROC} && \ - make install && \ - \ + make install + +ARG DOCKER_TAG +RUN mkdir /src +COPY . /src +WORKDIR /src + +RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ echo "Building OSRM ${DOCKER_TAG}" && \ - cd /src && \ git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \ echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \ mkdir build && \ cd build && \ - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_LTO=On .. && \ + 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 && \ make -j${NPROC} install && \ cd ../profiles && \ cp -r * /opt && \