shrijayan commited on
Commit
82a4b72
·
verified ·
1 Parent(s): 8278340

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -8
Dockerfile CHANGED
@@ -7,22 +7,26 @@ WORKDIR /data
7
  # Install wget (required to download OSM data)
8
  RUN apt-get update && apt-get install -y wget
9
 
 
 
 
 
10
  # Download an example OSM extract (Berlin)
11
  RUN wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
12
 
13
  # Preprocess the OSM data:
14
  # 1. Extract data using the car profile
15
- # 2. Partition the graph for the MLD algorithm
16
- # 3. Customize the partitioned data
17
  RUN osrm-extract -p /opt/car.lua berlin-latest.osm.pbf && \
18
- osrm-partition berlin-latest.osrm && \
19
- osrm-customize berlin-latest.osrm
20
 
21
- # Fix permissions: Make files accessible to the 'osrm' user
22
  RUN chown -R osrm:osrm /data
23
 
24
- # Expose port 7860 (Hugging Face Spaces expects the app to listen on this port)
25
  EXPOSE 7860
26
 
27
- # Start the OSRM routing engine on port 7860 using the MLD pipeline
28
- CMD ["osrm-routed", "--algorithm", "mld", "--port", "7860", "berlin-latest.osrm"]
 
7
  # Install wget (required to download OSM data)
8
  RUN apt-get update && apt-get install -y wget
9
 
10
+ # Create 'osrm' group and user to fix permission issues
11
+ RUN groupadd -r osrm && \
12
+ useradd -r -g osrm -d /data -s /sbin/nologin osrm
13
+
14
  # Download an example OSM extract (Berlin)
15
  RUN wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
16
 
17
  # Preprocess the OSM data:
18
  # 1. Extract data using the car profile
19
+ # 2. Partition the graph for MLD algorithm
20
+ # 3. Customize partitioned data
21
  RUN osrm-extract -p /opt/car.lua berlin-latest.osm.pbf && \
22
+ osrm-partition berlin-latest.osm && \
23
+ osrm-customize berlin-latest.osm
24
 
25
+ # Ensure files are owned by 'osrm' for proper service execution
26
  RUN chown -R osrm:osrm /data
27
 
28
+ # Expose port 7860 for Hugging Face Spaces
29
  EXPOSE 7860
30
 
31
+ # Start OSRM routing engine on port 7860 using MLD algorithm
32
+ CMD ["osrm-routed", "--algorithm", "mld", "--port", "7860", "berlin-latest.osm"]