diff --git a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py index 5ade8fb..901eacb 100644 --- a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py +++ b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py @@ -25,10 +25,11 @@ import modal # Get the directory where this script actually lives on the machine running it SCRIPT_DIR = Path(__file__).resolve().parent -# Automatically resolve the root of the repository (climbing up 3 levels) -# From: deps/implementation/backend_deploy/gitea_modal_build.py -# To: CODEBASE/ -PROJECT_ROOT = SCRIPT_DIR.parents[2] +# Walk up until we find a marker directory that identifies the repo root. +# This makes the script robust regardless of where Modal mounts it. +PROJECT_ROOT = SCRIPT_DIR +while not (PROJECT_ROOT / "backend").exists() and PROJECT_ROOT != PROJECT_ROOT.parent: + PROJECT_ROOT = PROJECT_ROOT.parent # Explicitly find your local Dockerfile DOCKERFILE_PATH = SCRIPT_DIR / "Dockerfile"