forked from chuwyton/TokyoGTFS
-
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.
Update readme and add docker support (#3)
* Add docker support * update README.md
- Loading branch information
james-r2r
authored
Dec 6, 2022
1 parent
c641529
commit 8b1ed9f
Showing
9 changed files
with
91 additions
and
9 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Tokyo GTFS | ||
gtfs/* | ||
output/* | ||
temp/* | ||
ekikara/* | ||
ignore* | ||
|
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,15 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# create the base image with the dependencies | ||
FROM python:3.7-alpine AS baseimage | ||
WORKDIR /install/ | ||
COPY requirements.txt requirements.txt | ||
RUN pip3 install -r requirements.txt | ||
|
||
# Now add in the app source code | ||
FROM baseimage AS build | ||
WORKDIR /app/ | ||
COPY /data ./data | ||
COPY /src ./src | ||
COPY *.py . | ||
ENTRYPOINT ["python3"] |
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
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
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,50 @@ | ||
import argparse | ||
import time | ||
import sys | ||
import os | ||
|
||
from src.static_buses import BusParser | ||
from src.static_trains import TrainParser | ||
from src.const import HEADER | ||
|
||
if __name__ == "__main__": | ||
args_parser = argparse.ArgumentParser() | ||
args_parser.add_argument("-a", "--apikey", metavar="YOUR_APIKEY", | ||
help="apikey from api.odpt.org") | ||
args = args_parser.parse_args() | ||
|
||
# Apikey checks | ||
if args.apikey: | ||
apikey = args.apikey | ||
|
||
elif os.path.exists("apikey.txt"): | ||
with open("apikey.txt", mode="r", encoding="utf8") as f: | ||
apikey = f.read().strip() | ||
|
||
else: | ||
sys.exit( | ||
"No apikey!\n" | ||
"Provide it inside command line argument '--apikey',\n" | ||
"Or put it inside a file named 'apikey.txt'." | ||
) | ||
|
||
start_time = time.time() | ||
print(HEADER) | ||
print("=== Trains GTFS ===") | ||
|
||
print("Warming up") | ||
TrainParser.parse(apikey) | ||
|
||
total_time = time.time() - start_time | ||
print("=== Trains GTFS: Finished in {} s ===".format(round(total_time, 2))) | ||
|
||
|
||
start_time = time.time() | ||
print(HEADER) | ||
print("=== Buses GTFS ===") | ||
|
||
print("Warming up") | ||
BusParser.parse(apikey) | ||
|
||
total_time = time.time() - start_time | ||
print("=== Buses GTFS: Finished in {} s ===".format(round(total_time, 2))) |
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
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
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
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