DerYur commited on
Commit
43f2aa7
·
verified ·
1 Parent(s): 9c5f0d8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -25
Dockerfile CHANGED
@@ -1,29 +1,25 @@
1
- # Use Python base image
2
- FROM python:3.10-slim
 
3
 
4
- # Set working directory
5
- WORKDIR /app
 
 
 
6
 
7
- # Install OS-level dependencies
8
- RUN apt-get update && apt-get install -y \
9
- git \
10
- ffmpeg \
11
- libsndfile1 \
12
- libportaudio2 \
13
- && rm -rf /var/lib/apt/lists/*
14
 
15
- # Copy code into container
16
- COPY . .
 
17
 
18
- # Install Python dependencies
19
- RUN pip install --no-cache-dir -r requirements.txt
20
-
21
- # Prevent Streamlit from auto-running
22
- ENV STREAMLIT_SERVER_HEADLESS=true
23
- ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
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
+ ])