Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LABEL \
org.opencontainers.image.vendor="https://peterevans.dev" \
org.opencontainers.image.licenses="MIT"

ENV OSRM_VERSION 5.22.0
ENV OSRM_VERSION 5.26.0

# Let the container know that there is no TTY
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -33,9 +33,9 @@ RUN apt-get -y update \
pkg-config \
gcc \
python-dev \
python-pip \
python-setuptools \
&& apt-get clean \
&& easy_install -U pip \
&& pip install -U crcmod \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* /var/tmp/*
Expand All @@ -56,6 +56,10 @@ RUN mkdir /osrm-src \
&& cp -r /osrm-src/osrm-backend-$OSRM_VERSION/profiles/* /osrm-profiles \
&& rm -rf /osrm-src

# allows for adding prebuilt files to the image for faster use in dev without egress charges
# expects data in same format as on gs, so prebuilt/$OSRM_DATA_LABEL/*.osrm*
COPY prebuilt/ /prebuilt/

# Set the entrypoint
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
Expand Down
11 changes: 8 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trap _sig SIGKILL SIGTERM SIGHUP SIGINT EXIT
if [ "$OSRM_MODE" == "CREATE" ]; then

# Retrieve the PBF file
curl -L $OSRM_PBF_URL --create-dirs -o $OSRM_DATA_PATH/$OSRM_DATA_LABEL.osm.pbf
curl -k -L $OSRM_PBF_URL --create-dirs -o $OSRM_DATA_PATH/$OSRM_DATA_LABEL.osm.pbf

# Build the graph
osrm-extract $OSRM_DATA_PATH/$OSRM_DATA_LABEL.osm.pbf -p /osrm-profiles/$OSRM_GRAPH_PROFILE.lua
Expand All @@ -45,8 +45,13 @@ if [ "$OSRM_MODE" == "CREATE" ]; then
fi

else

if [ ! -z "$OSRM_SA_KEY_PATH" ] && [ ! -z "$OSRM_PROJECT_ID" ] && [ ! -z "$OSRM_GS_BUCKET" ]; then
if [ -d /prebuilt ] && [ -d /prebuilt/$OSRM_DATA_LABEL ] ; then
cd $OSRM_DATA_PATH || exit
for i in /prebuilt/"$OSRM_DATA_LABEL"/*; do
echo ln -s "$i"
ln -s "$i" .
done
elif [ -n "$OSRM_SA_KEY_PATH" ] && [ -n "$OSRM_PROJECT_ID" ] && [ -n "$OSRM_GS_BUCKET" ]; then

# Activate the service account to access storage
gcloud auth activate-service-account --key-file $OSRM_SA_KEY_PATH
Expand Down