Amey9766 commited on
Commit
77a5691
·
verified ·
1 Parent(s): 75703ab

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -11
Dockerfile CHANGED
@@ -1,27 +1,34 @@
1
  FROM python:3.13-slim
2
 
3
- WORKDIR /app
 
4
 
 
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
- build-essential \
7
- curl \
8
- git \
9
- && rm -rf /var/lib/apt/lists/*
10
 
 
11
  ENV PYTHONDONTWRITEBYTECODE=1 \
12
  PYTHONUNBUFFERED=1 \
13
  PIP_NO_CACHE_DIR=1 \
14
  STREAMLIT_HOME=/tmp \
15
  STREAMLIT_TELEMETRY_ENABLED=false
16
 
17
- COPY requirements.txt .
 
18
  RUN pip install -r requirements.txt
19
 
 
20
  COPY . .
21
 
22
- EXPOSE 8501
 
 
 
23
 
24
- HEALTHCHECK --interval=30s --timeout=3s --start-period=25s --retries=3 \
25
- CMD curl -fsS http://localhost:8501/_stcore/health || exit 1
26
-
27
- CMD ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
  FROM python:3.13-slim
2
 
3
+ # 1) Workdir where we copy the repo
4
+ WORKDIR /workspace
5
 
6
+ # 2) System deps
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ build-essential curl git && \
9
+ rm -rf /var/lib/apt/lists/*
 
 
10
 
11
+ # 3) Python/Streamlit env tweaks
12
  ENV PYTHONDONTWRITEBYTECODE=1 \
13
  PYTHONUNBUFFERED=1 \
14
  PIP_NO_CACHE_DIR=1 \
15
  STREAMLIT_HOME=/tmp \
16
  STREAMLIT_TELEMETRY_ENABLED=false
17
 
18
+ # 4) Install requirements first for caching
19
+ COPY requirements.txt ./requirements.txt
20
  RUN pip install -r requirements.txt
21
 
22
+ # 5) Copy everything in the Space repo (including your app file)
23
  COPY . .
24
 
25
+ # 6) Hugging Face Spaces provides $PORT; default for local tests
26
+ ENV PORT=7860
27
+ # Pick your main file here (change if your filename differs)
28
+ ENV APP_FILE=streamlit_app.py
29
 
30
+ # 7) Helpful listing before launching so you can debug paths quickly
31
+ CMD bash -lc 'echo "CWD: $(pwd)"; echo "--- top level ---"; ls -lah; \
32
+ echo "--- python files ---"; find . -maxdepth 2 -type f -name "*.py" -print; \
33
+ echo "Starting Streamlit on $PORT using $APP_FILE"; \
34
+ streamlit run "$APP_FILE" --server.address 0.0.0.0 --server.port "$PORT"'