Added docker commands to Makefile

make data and make container can be used to pre-process the data and spawn the docker containers.
This commit is contained in:
syounkin 2024-11-04 18:50:21 -06:00
parent c0717d36bb
commit 6455542eac
6 changed files with 67 additions and 0 deletions

View File

@ -4,6 +4,18 @@ walk: route_analysis.Rmd
cycle: cycling_route_analysis.Rmd cycle: cycling_route_analysis.Rmd
R -e 'library("rmarkdown"); old_path <- Sys.getenv("PATH"); Sys.setenv(PATH = paste(old_path, "/usr/local/bin", sep = ":")); rmarkdown::render(knit_root_dir = "./", output_dir = "./html", input = "./cycling_route_analysis.Rmd", output_file = "./html/cycling_route_analysis.html")' R -e 'library("rmarkdown"); old_path <- Sys.getenv("PATH"); Sys.setenv(PATH = paste(old_path, "/usr/local/bin", sep = ":")); rmarkdown::render(knit_root_dir = "./", output_dir = "./html", input = "./cycling_route_analysis.Rmd", output_file = "./html/cycling_route_analysis.html")'
container: ./docker/docker-compose.yml
cd ./docker/; docker compose up -d
data:
cd ./docker/; docker run -t -v "./data-foot:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-extract -p /opt/foot.lua /data/wisconsin-latest.osm.pbf
cd ./docker/; docker run -t -v "./data-foot:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-partition /data/wisconsin-latest.osrm
cd ./docker/; docker run -t -v "./data-foot:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-customize /data/wisconsin-latest.osrm
cd ./docker/; docker run -t -v "./data-bicycle:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-extract -p /opt/bicycle.lua /data/wisconsin-latest.osm.pbf
cd ./docker/; docker run -t -v "./data-bicycle:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-partition /data/wisconsin-latest.osrm
cd ./docker/; docker run -t -v "./data-bicycle:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-customize /data/wisconsin-latest.osrm
clean: clean-data clean-figure clean-script clean: clean-data clean-figure clean-script
clean-data: clean-data:
@ -16,3 +28,4 @@ clean-figure:
rm -rvf ./figure/ rm -rvf ./figure/
.PHONY: data .PHONY: data

10
docker/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
!docker-compose.yml
!docker-compose-2.yml
!preprocess.sh
!data-raw/
!data-foot/
!data-bicycle/

4
docker/data-bicycle/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
docker/data-foot/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
docker/data-raw/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

32
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,32 @@
---
services:
osrm-backend-foot:
container_name: osrm-backend-foot
ports:
- 5000:5000
volumes:
- ./data-foot:/data
- ./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf
image: osrm/osrm-backend
command: osrm-routed --algorithm mld /data/wisconsin-latest.osrm
osrm-backend-bicycle:
container_name: osrm-backend-bicycle
ports:
- 5001:5000
volumes:
- ./data-bicycle:/data
- ./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf
image: osrm/osrm-backend
command: osrm-routed --algorithm mld /data/wisconsin-latest.osrm
osrm-frontend-foot:
ports:
- 9966:9966
environment:
OSRM_BACKEND: 'http://localhost:5000'
image: osrm/osrm-frontend
osrm-frontend-bicycle:
ports:
- 9967:9966
environment:
OSRM_BACKEND: 'http://localhost:5001'
image: osrm/osrm-frontend