Docker Image
phidomo opened this issue · 2 comments
I'm trying to build a docker image with the following Dockerfile:
Dockerfile
FROM ubuntu
MAINTAINER John Doe
RUN apt-get update && apt-get install -y
sudo
curl
wget
git
- Install nodejs and npm
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
RUN sudo apt-get install -y nodejs
- Install node-osrm
RUN mkdir /work
WORKDIR /work
RUN npm install osrm
- Download profiles
RUN git clone https://github.com/Project-OSRM/osrm-backend.git
RUN cp -r /work/osrm-backend/profiles/ /work/node_modules/osrm/lib/
- Download map
WORKDIR /work/node_modules/osrm/lib/binding
RUN wget http://download.bbbike.org/osm/bbbike/Tokyo/Tokyo.osm.pbf
- Make network
RUN ln -s ../profiles/car.lua profile.lua
RUN ./osrm-extract -p profile.lua Tokyo.osm.pbf
RUN ./osrm-contract Tokyo.osrm
ENTRYPOINT "/bin/bash"
Error
I get the following error at step "RUN ./osrm-extract -p profile.lua Tokyo.osm.pbf":
[info] Parsing in progress.. [warn] ERROR occurred in profile script: /work/node_modules/osrm/lib/profiles/lib/guidance.lua:4: attempt to index a nil value (global 'road_priority_class')
You have to make sure the profiles are in sync with the node binaries you're downloading via npm.
For example, if you download osrm v5.3.3 you have to use the osrm-backend profiles shipping with v5.3.3. There is a ticket for shipping profiles with the node bindings to solve exactly this problem: #242. Until then you have to git checkout the tag yourself, sorry.
cc @springmeyer for node-osrm packaging.
@daniel-j-h Thanks that solved the problem. I made the following changes:
Dockerfile
#- Install node-osrm
RUN mkdir /work
WORKDIR /work
RUN npm install osrm@5.3.3
#- Download profiles
RUN git clone https://github.com/Project-OSRM/osrm-backend.git
WORKDIR /work/osrm-backend
RUN git checkout 7aaf60d05fde691d5e3f9741ce0e52671ab2db43 &&
git reset --hard
RUN cp -r /work/osrm-backend/profiles/ /work/node_modules/osrm/lib/