Amey9766 commited on
Commit
bc17f84
·
verified ·
1 Parent(s): 357646c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -6
Dockerfile CHANGED
@@ -1,28 +1,38 @@
 
1
  FROM python:3.13-slim
2
 
 
3
  WORKDIR /workspace
4
 
 
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
  build-essential curl git && \
7
  rm -rf /var/lib/apt/lists/*
8
 
 
9
  ENV PYTHONDONTWRITEBYTECODE=1 \
10
  PYTHONUNBUFFERED=1 \
11
  PIP_NO_CACHE_DIR=1 \
12
  STREAMLIT_HOME=/tmp \
13
  STREAMLIT_TELEMETRY_ENABLED=false
14
 
 
15
  COPY requirements.txt ./requirements.txt
16
  RUN pip install -r requirements.txt
17
 
 
18
  COPY . .
19
 
20
- # HF Spaces provides $PORT; default for local tests
21
  ENV PORT=7860
22
- # 👇 your app is under ./src
 
23
  ENV APP_FILE=src/streamlit_app.py
24
 
25
- CMD bash -lc 'echo "CWD: $(pwd)"; echo "--- top level ---"; ls -lah; \
26
- echo "--- python files ---"; find . -maxdepth 2 -type f -name "*.py" -print; \
27
- echo "Starting Streamlit on $PORT using $APP_FILE"; \
28
- streamlit run "$APP_FILE" --server.address 0.0.0.0 --server.port "$PORT"'
 
 
 
 
1
+ # Use a small Python base
2
  FROM python:3.13-slim
3
 
4
+ # Workdir inside the container
5
  WORKDIR /workspace
6
 
7
+ # System deps (minimal) and cleanup
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  build-essential curl git && \
10
  rm -rf /var/lib/apt/lists/*
11
 
12
+ # Python/Streamlit env
13
  ENV PYTHONDONTWRITEBYTECODE=1 \
14
  PYTHONUNBUFFERED=1 \
15
  PIP_NO_CACHE_DIR=1 \
16
  STREAMLIT_HOME=/tmp \
17
  STREAMLIT_TELEMETRY_ENABLED=false
18
 
19
+ # Install Python deps first for better caching
20
  COPY requirements.txt ./requirements.txt
21
  RUN pip install -r requirements.txt
22
 
23
+ # Copy the rest of the repo (including your app code)
24
  COPY . .
25
 
26
+ # Hugging Face Spaces will set $PORT; keep a default for local testing
27
  ENV PORT=7860
28
+
29
+ # 👇 Your Streamlit entry file (change if different)
30
  ENV APP_FILE=src/streamlit_app.py
31
 
32
+ # Run Streamlit bound to 0.0.0.0 and $PORT, with proxy-friendly flags
33
+ CMD ["bash","-lc","streamlit run $APP_FILE \
34
+ --server.address 0.0.0.0 \
35
+ --server.port $PORT \
36
+ --server.headless true \
37
+ --server.enableCORS false \
38
+ --server.enableXsrfProtection false"]