OpenStreetRoutingMap Docker

OpenStreetRoutingMap Docker

我正在尝试构建一个导入 OSRM 后端服务器的 docker,然后立即导入并提取正确的 osm.pbf 文件。 现在我不知何故无处可去。 到目前为止我的 Docker 文件:

# import docker file
FROM osrm/osrm-backend:v5.25.0

# define variables
ARG OSM_FILE=/data/berlin-latest.osm.pbf
ARG OSRM_FILE=/data/berlin-latest.osrm
ARG DOWNLOAD_URL=http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf

# transform variables
ENV OSM_FILE=$OSM_FILE
ENV OSRM_FILE=$OSRM_FILE
ENV DOWNLOAD_URL=$DOWNLOAD_URL

# install wget
RUN apt-get update
RUN apt install -y wget

# download data
RUN wget $DOWNLOAD_URL

# import the file
RUN -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua $OSM_FILE
RUN -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition $OSRM_FILE
RUN -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize $OSRM_FILE

# start docker
RUN -t -i -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld $OSRM_FILE

到目前为止,我只 运行 Docker,但自己还没有构建过。 感谢您的帮助!!

这是我的工作 Dockerfile

# import docker file
FROM osrm/osrm-backend:v5.25.0

# define variables
ARG DOWNLOAD_URL=http://download.geofabrik.de/europe/germany-latest.osm.pbf
ARG OSM_FILE=germany-latest.osm.pbf
ARG OSRM_FILE=germany-latest.osrm

# transform variables
ENV OSM_FILE=$OSM_FILE
ENV OSRM_FILE=$OSRM_FILE
ENV DOWNLOAD_URL=$DOWNLOAD_URL

# install wget
RUN apt-get update
RUN apt install -y wget

# download data
RUN mkdir data
RUN cd data
RUN wget $DOWNLOAD_URL

# extract the osm file
RUN osrm-extract -p /opt/car.lua $OSM_FILE
# delete the osm file
RUN rm -rf $OSM_FILE
# create other formats
RUN osrm-partition $OSRM_FILE
RUN osrm-customize $OSRM_FILE

# Start the docker
CMD osrm-routed --algorithm mld $OSRM_FILE

EXPOSE 5000```

The build takes a long time though, just under 45 minutes on an 8 core PC with 16 GB.