Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +21 -25
Dockerfile
CHANGED
|
@@ -1,29 +1,25 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
ffmpeg \
|
| 11 |
-
libsndfile1 \
|
| 12 |
-
libportaudio2 \
|
| 13 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# Expose the port for Uvicorn + FastAPI
|
| 26 |
-
EXPOSE 7860
|
| 27 |
-
|
| 28 |
-
# Launch FastAPI (which internally loads Streamlit UI if integrated manually)
|
| 29 |
-
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.headless=true"]
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import time
|
| 4 |
|
| 5 |
+
# Clone your private repo only (DO NOT launch Streamlit here!)
|
| 6 |
+
GITHUB_USERNAME = "DeYurt"
|
| 7 |
+
GITHUB_REPO = "Welcome_Call_Agent"
|
| 8 |
+
GITHUB_BRANCH = "main"
|
| 9 |
+
CODE_DIR = "/tmp/hidden_code"
|
| 10 |
|
| 11 |
+
HF_TOKEN = os.environ.get("GITHUB_TOKEN")
|
| 12 |
+
if HF_TOKEN is None:
|
| 13 |
+
raise RuntimeError("❌ Missing GITHUB_TOKEN in Hugging Face secrets!")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
if not os.path.exists(CODE_DIR):
|
| 16 |
+
repo_url = f"https://{HF_TOKEN}@github.com/{GITHUB_USERNAME}/{GITHUB_REPO}.git"
|
| 17 |
+
subprocess.run(["git", "clone", "--depth", "1", "--branch", GITHUB_BRANCH, repo_url, CODE_DIR], check=True)
|
| 18 |
|
| 19 |
+
# Replace current app.py with hidden_code/app.py and re-run Streamlit
|
| 20 |
+
os.execvp("streamlit", [
|
| 21 |
+
"streamlit", "run", os.path.join(CODE_DIR, "app.py"),
|
| 22 |
+
"--server.port=7860",
|
| 23 |
+
"--server.headless=true",
|
| 24 |
+
"--server.address=0.0.0.0"
|
| 25 |
+
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|