Skip to content

Commit

Permalink
Add docker compose file and makefile command for easier development
Browse files Browse the repository at this point in the history
  • Loading branch information
Zebreu committed Dec 20, 2024
1 parent b8ac065 commit ee22faf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
24 changes: 24 additions & 0 deletions dkroutingtool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,27 @@ restartingdemo:
-d \
--restart=always \
dashboard:latest

# replace absolute path D:/repos/ with your own
olddevelop:
cd src/py/ui && docker build -t dashboard -f dashboard.dockerfile .
docker run \
--add-host=host.docker.internal:host-gateway \
--name server \
-p 5001:5001 \
-d \
--rm \
ghcr.io/datakind/dk-routing:main \
/opt/conda/bin/python src/py/server.py
docker run \
-e SERVER_HOST='host.docker.internal' \
--add-host=host.docker.internal:host-gateway \
--name dashboard \
-p 8501:8501 \
-d \
--rm \
-v D:/repos/dk-routing/dkroutingtool/src/py/ui/:/src/app/ \
dashboard:latest

develop:
docker compose up
16 changes: 16 additions & 0 deletions dkroutingtool/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
backend:
image: ghcr.io/datakind/dk-routing:main
command: /opt/conda/bin/python src/py/server.py
ports:
- "5001:5001"
frontend:
environment:
SERVER_HOST: backend
build:
context: ./src/py/ui/
dockerfile: dashboard.dockerfile
ports:
- "8501:8501"
volumes:
- ./src/py/ui:/src/app
2 changes: 1 addition & 1 deletion dkroutingtool/src/py/ui/dashboard.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ COPY dashboard.py /src/app

EXPOSE 8501

CMD streamlit run /src/app/dashboard.py --browser.gatherUsageStats=False --theme.base="dark" --server.address=0.0.0.0
CMD streamlit run /src/app/dashboard.py --browser.gatherUsageStats=False --theme.base="dark" --server.address=0.0.0.0 --server.runOnSave=True --server.headless=True --server.fileWatcherType="poll"

0 comments on commit ee22faf

Please sign in to comment.