From dd9a92d34ed034c1e6bfb07842e6e3a88bef8eb3 Mon Sep 17 00:00:00 2001 From: Dennis Becker Date: Mon, 6 Jul 2026 15:58:53 +0200 Subject: [PATCH] Frontend fix --- backend/app/main.py | 17 ++++++++++------- backend/requirements.txt | 1 + docker-compose.yml | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index 346c40d6..a32eb6bd 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -43,24 +43,27 @@ async def health_check(): return {"status": "healthy", "service": "coffee-control-center-api"} # Serve Frontend static files in production if built -FRONTEND_DIR = os.path.join( - os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), - "frontend", "dist", "coffee-control-center", "browser" -) +# __file__ is /app/app/main.py → go up 2 levels to reach /app +_APP_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +FRONTEND_DIR = os.path.join(_APP_ROOT, "frontend", "dist", "coffee-control-center", "browser") + +# Docker fallback: files are placed at /app/frontend/dist/... by the Dockerfile +if not os.path.exists(FRONTEND_DIR): + FRONTEND_DIR = "/app/frontend/dist/coffee-control-center/browser" if os.path.exists(FRONTEND_DIR): @app.get("/{fallback_path:path}") async def serve_frontend(fallback_path: str): if fallback_path.startswith("api"): raise HTTPException(status_code=404, detail="API route not found") - + file_path = os.path.join(FRONTEND_DIR, fallback_path) if os.path.isfile(file_path): return FileResponse(file_path) - + index_path = os.path.join(FRONTEND_DIR, "index.html") if os.path.isfile(index_path): return FileResponse(index_path) - + raise HTTPException(status_code=404, detail="Frontend file not found") diff --git a/backend/requirements.txt b/backend/requirements.txt index 9fd6b61c..a3f2b004 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -4,3 +4,4 @@ motor>=3.3.2 pydantic>=2.6.4 pydantic-settings>=2.2.1 dnspython>=2.6.1 +email-validator>=2.1.0 diff --git a/docker-compose.yml b/docker-compose.yml index f0b044ea..f8c9fa05 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ services: mongodb: image: mongo:4.4 + platform: linux/amd64 container_name: coffee-mongodb restart: unless-stopped ports: @@ -12,6 +13,7 @@ services: build: context: . dockerfile: Dockerfile + platform: linux/amd64 container_name: coffee-app restart: unless-stopped ports: