diff --git a/backend/Dockerfile b/backend/Dockerfile index a657a1d..4a9b5bb 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -37,5 +37,5 @@ RUN poetry install FROM set_poetry as app_ready #EXPOSE 80 -COPY src/ . -CMD ["poetry", "run", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"] +COPY src/ src +CMD ["poetry", "run", "uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] diff --git a/backend/src/api/main.py b/backend/src/api/main.py index ee60be1..87a1b02 100644 --- a/backend/src/api/main.py +++ b/backend/src/api/main.py @@ -1,8 +1,10 @@ from fastapi import FastAPI +from ..config import config app = FastAPI() -@app.get("/") -async def root(): - return {"message": "Hello World"} +@app.get("/months") +async def get_months(): + print(config) + return {"message": "plop"} diff --git a/backend/src/config.py b/backend/src/config.py new file mode 100644 index 0000000..1bf9806 --- /dev/null +++ b/backend/src/config.py @@ -0,0 +1,9 @@ +import os + +config = {} + +try: + config["datapath"] = os.environ["DATASPATH"] +except KeyError: + config["datapath"] = "/datas" + diff --git a/docker-compose_live.yml b/docker-compose_live.yml new file mode 100644 index 0000000..d567c3d --- /dev/null +++ b/docker-compose_live.yml @@ -0,0 +1,11 @@ +--- +version: '3.8' + +services: + back: + build: ./backend + ports: + - 8000:8000 + volumes: + - ./backend/src:/app/src + - ./datas:/datas