Configure Dockerfile for integration with Docker Cloud/Dockerhub for (#3850)

automated image creation.
This commit is contained in:
Daniel Patterson 2017-03-21 12:53:12 -07:00 committed by GitHub
parent 810e3c6a66
commit ff238c2724
2 changed files with 15 additions and 2 deletions

View File

@ -1,11 +1,15 @@
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 && \
@ -21,11 +25,11 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
make -j${NPROC} && \
make install && \
\
echo "Building OSRM" &&\
echo "Building OSRM ${DOCKER_TAG}" && \
cd /src && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=On .. && \
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_LTO=On .. && \
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \

9
docker/hooks/build Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
# We've placed the Dockerfile under docker/ so that the generically named
# hooks/ directory doesn't pollute the main directory. Because we need to
# COPY the source into the container, we need to use some -f gymnastics to
# ensure that "COPY . /src" is referring to the repo root, not the directory
# that contains the Dockerfile.
# This script gets executed with a pwd of wherever the Dockerfile is.
docker build --build-arg DOCKER_TAG=${DOCKER_TAG} -t $IMAGE_NAME -f Dockerfile ..