forked from sharedstreets/mobility-metrics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Dockerfile and docs for running from container
- Loading branch information
1 parent
0613331
commit 590c28d
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM node:11 | ||
|
||
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global | ||
ENV PATH=$PATH:/home/node/.npm-global/bin | ||
|
||
USER node | ||
RUN npm install -g mobility-metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,38 @@ The CLI is responsible for downloading raw data, running aggregation and reports | |
mobility-metrics --config ./example/example.json --public ./public --cache ./cache --day 2019-07-20; | ||
``` | ||
|
||
## Docker | ||
|
||
Docker is supported, and is recommended when installation is challenging on bespoke systems that fail when installing dependencies, such as OSRM. | ||
|
||
### Building a docker image | ||
|
||
```sh | ||
# clone repo | ||
git clone [email protected]:sharedstreets/mobility-metrics.git | ||
cd mobility-metrics | ||
|
||
# build image | ||
docker build --tag mobility-metrics-image . | ||
``` | ||
|
||
### Running mobility-metrics from docker image | ||
|
||
Once you have a docker image built, use mobility-metrics CLI from within the image using `docker run`. In this example, a config file exists in the current directory, which mobility-metrics can read using the mounted volume. | ||
|
||
```sh | ||
docker run -it --rm \ | ||
-v $PWD:/data/ \ # mount current working directory to image volume | ||
mobility-metrics-image \ | ||
mobility-metrics \ | ||
--config /data/config.json \ | ||
--public /data/public \ | ||
--cache /data/cache \ | ||
--startDay 2019-09-20 \ | ||
--endDay 2019-09-20 \ | ||
--reportDay 2019-09-20; | ||
``` | ||
|
||
## Serving API | ||
|
||
The metrics data and reports generated by the mobility-metrics CLI are intended to be served from a static HTTP server, such as apache, nginx, or a public HTTP service like netifly or Github Pages. See the gh-pages branch of this repository to see how the demo for this tool is hosted using simulated data in Nashville, TN. | ||
|
@@ -176,5 +208,3 @@ Runs a linter, prettier, and auto-formats code to meet consistent style, while c | |
```sh | ||
npm run lint | ||
``` | ||
|
||
|