diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d7b455a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.11.6-alpine3.18 +WORKDIR /app + +COPY requierements.txt /app/ +COPY app /app/app + + +RUN pip install --upgrade pip && pip install -r requierements.txt + + +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file diff --git a/app/main.py b/app/main.py index f49d8ae..635876b 100644 --- a/app/main.py +++ b/app/main.py @@ -12,8 +12,10 @@ app.include_router(mail.router) @app.on_event("startup") async def startup_event(): - user_add.add(username="Peter93", password="toto", roles="Admin") - user_add.add(username="Robert80", password="titi", roles="User") + if len(os.environ["USERNAME_ADMIN"]) > 0 and len(os.environ["PASSWORD_ADMIN"]) > 0: + user_add.add(username=os.environ["USERNAME_ADMIN"], password=os.environ["PASSWORD_ADMIN"], roles="Admin") + if len(os.environ["USERNAME_TEST"]) > 0 and len(os.environ["PASSWORD_TEST"]) > 0: + user_add.add(username=os.environ["USERNAME_TEST"], password=os.environ["PASSWORD_TEST"], roles="User") @app.get("/") async def root():