File size: 1,514 Bytes
3f3f0ca
d5b00a1
77a5691
d5b00a1
bd206dd
3f3f0ca
77a5691
 
d5b00a1
bc17f84
3f3f0ca
 
75703ab
 
 
3f3f0ca
bb24471
77a5691
3f3f0ca
 
bb24471
0f1a4f6
d5b00a1
bb24471
77a5691
bc17f84
bb24471
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM python:3.13-slim

WORKDIR /workspace

# Minimal system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential curl git && \
    rm -rf /var/lib/apt/lists/*

# Python/Streamlit env
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    STREAMLIT_HOME=/tmp \
    STREAMLIT_TELEMETRY_ENABLED=false

# Install Python deps first for caching
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt

# Copy your repo
COPY . .

# HF Spaces gives $PORT; keep default for local test
ENV PORT=7860

# 🔎 Auto-discover the app file and start Streamlit
CMD bash -lc '\
  echo "===== Application Startup ====="; \
  echo "CWD: $(pwd)"; \
  echo "--- top level ---"; ls -lah; \
  echo "--- python files (depth 2) ---"; find . -maxdepth 2 -type f -name "*.py" -print; \
  APP_FILE=""; \
  for f in "streamlit_app.py" "src/streamlit_app.py" "app.py" "src/app.py"; do \
    if [ -f "$f" ]; then APP_FILE="$f"; break; fi; \
  done; \
  if [ -z "$APP_FILE" ]; then \
    echo "ERROR: Could not find streamlit entry file (tried streamlit_app.py, src/streamlit_app.py, app.py, src/app.py)"; \
    exit 1; \
  fi; \
  echo "Starting Streamlit on $PORT using $APP_FILE"; \
  streamlit run "$APP_FILE" \
    --server.address 0.0.0.0 \
    --server.port "$PORT" \
    --server.headless true \
    --server.enableCORS false \
    --server.enableXsrfProtection false \
    --browser.gatherUsageStats false \
    --server.fileWatcherType none \
'