Amey9766 commited on
Commit
bb24471
·
verified ·
1 Parent(s): 1f1f918

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -14
Dockerfile CHANGED
@@ -14,24 +14,37 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
14
  STREAMLIT_HOME=/tmp \
15
  STREAMLIT_TELEMETRY_ENABLED=false
16
 
17
- # Install Python deps first for faster rebuilds
18
  COPY requirements.txt ./requirements.txt
19
  RUN pip install -r requirements.txt
20
 
21
- # Copy the rest of the Space repo (includes streamlit_app.py)
22
  COPY . .
23
 
24
- # Hugging Face Spaces sets $PORT (keep a default for local testing)
25
  ENV PORT=7860
26
- # Your app file is at the repo root
27
- ENV APP_FILE=streamlit_app.py
28
 
29
- # Run Streamlit bound to the Space proxy, with proxy-friendly flags
30
- CMD ["bash","-lc","streamlit run $APP_FILE \
31
- --server.address 0.0.0.0 \
32
- --server.port $PORT \
33
- --server.headless true \
34
- --server.enableCORS false \
35
- --server.enableXsrfProtection false \
36
- --browser.gatherUsageStats false \
37
- --server.fileWatcherType none"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  STREAMLIT_HOME=/tmp \
15
  STREAMLIT_TELEMETRY_ENABLED=false
16
 
17
+ # Install Python deps first for caching
18
  COPY requirements.txt ./requirements.txt
19
  RUN pip install -r requirements.txt
20
 
21
+ # Copy your repo
22
  COPY . .
23
 
24
+ # HF Spaces gives $PORT; keep default for local test
25
  ENV PORT=7860
 
 
26
 
27
+ # 🔎 Auto-discover the app file and start Streamlit
28
+ CMD bash -lc '\
29
+ echo "===== Application Startup ====="; \
30
+ echo "CWD: $(pwd)"; \
31
+ echo "--- top level ---"; ls -lah; \
32
+ echo "--- python files (depth 2) ---"; find . -maxdepth 2 -type f -name "*.py" -print; \
33
+ APP_FILE=""; \
34
+ for f in "streamlit_app.py" "src/streamlit_app.py" "app.py" "src/app.py"; do \
35
+ if [ -f "$f" ]; then APP_FILE="$f"; break; fi; \
36
+ done; \
37
+ if [ -z "$APP_FILE" ]; then \
38
+ echo "ERROR: Could not find streamlit entry file (tried streamlit_app.py, src/streamlit_app.py, app.py, src/app.py)"; \
39
+ exit 1; \
40
+ fi; \
41
+ echo "Starting Streamlit on $PORT using $APP_FILE"; \
42
+ streamlit run "$APP_FILE" \
43
+ --server.address 0.0.0.0 \
44
+ --server.port "$PORT" \
45
+ --server.headless true \
46
+ --server.enableCORS false \
47
+ --server.enableXsrfProtection false \
48
+ --browser.gatherUsageStats false \
49
+ --server.fileWatcherType none \
50
+ '