#!/bin/bash

IMAGE_NAME="osrm-backend"
CONTAINER_NAME="osrm-container"
OSRM_PORT=5000

code_path=`realpath .`
data_path=`realpath ../osrm_test/uk`

docker build -f Dockerfile.dev -t $IMAGE_NAME .

docker run \
    -v $data_path:/data \
    -v $code_path:/src \
    -p 5001:$OSRM_PORT \
    -it $IMAGE_NAME bash

############################################################
# to build valhalla
# - `clean`
# - `build`

# to run valhalla
# - `start`
############################################################

# === OSRM Development Detailed Instructions ===
# 
# 1. Build OSRM (first time or after code changes):
# build
#
# 2. Extract map data:
# extract -p /data/out/car.lua /data/out/input.osm.pbf
#
# 3. Partition the graph:
# partition /data/out/input.osrm
# partition /data/out/input.osrm --max-cell-sizes 32,1024,16384,524288
#
# 4. Customize:
# customize /data/out/input.osrm --segment-speed-file /data/ssp.csv
# customize /data/out/input.osrm --segment-speed-file /data/ssp.csv --selective-cell-customization true --speed-difference-threshold 0.05
#
# 5. Start routing server:
# start
# routed /data/out/input.osrm --algorithm mld
#
# 6. Clean up when needed:
# clean
#
# 7. Run tests:
# cd /src && bash ./run_all_tests.sh
# OSRM_WARMUP_BLOCK_SIZE=64KB OSRM_WARMUP_GB_PER_THREAD=1 OSRM_RECLAIM_RATIO=0 OSRM_MMAP_ADVICE=random OSRM_WARMUP_ENABLED=true /src/build/osrm-routed --algorithm mld --mmap=true --warmup=true /data/out/input.osrm