OpenStreetRoutingMap Docker

oug3syen  于 2023-05-06  发布在  Docker
关注(0)|答案(1)|浏览(144)

我试图构建一个导入OSRM后端服务器的docker,但随后立即导入并提取正确的osm.pbf文件。现在我不知怎么的哪儿也去不了了。到目前为止我的Dockerfile:

# 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,但我自己还没有构建过。谢谢你的帮助!!

vyswwuz2

vyswwuz21#

这是我的工作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

构建需要很长的时间,虽然,刚刚不到45分钟的8核PC与16 GB。

相关问题