import os from pathlib import Path from git import Repo import sys # ---- 1. pick a writable base dir (we'll stop using /app) BASE_DIR = Path("/tmp/gl_runtime") STREAMLIT_DIR = BASE_DIR / ".streamlit" REPO_TARGET = BASE_DIR / "gl" # ensure the base dir exists BASE_DIR.mkdir(parents=True, exist_ok=True) STREAMLIT_DIR.mkdir(parents=True, exist_ok=True) # ---- 2. tell Streamlit to treat /tmp/... as "home" os.environ.setdefault("HOME", str(BASE_DIR)) os.environ.setdefault("XDG_CONFIG_HOME", str(BASE_DIR)) os.environ.setdefault("STREAMLIT_CONFIG_DIR", str(STREAMLIT_DIR)) os.environ.setdefault("STREAMLIT_HOME", str(BASE_DIR)) os.environ.setdefault("STREAMLIT_BROWSER_GATHERUSAGESTATS", "false") # ---- 3. clone private repo into /tmp/gl_runtime/gl if not already there if not REPO_TARGET.exists(): git_url = os.environ.get("GIT_URL") if not git_url: raise RuntimeError("GIT_URL env var is not set") Repo.clone_from(git_url, REPO_TARGET) # make that repo importable sys.path.append(str(REPO_TARGET)) # ---- 4. now safe to import streamlit and run the app import streamlit as st import gl #st.write("repo loaded from", str(REPO_TARGET)) #st.image("huniutoo.png") #st.image("gwecon.png") gl.gl() # ...rest of your UI...