dhani10 commited on
Commit
7af6fa9
·
verified ·
1 Parent(s): 70ae4b9

Deploy Docker-based Streamlit app

Browse files
Files changed (2) hide show
  1. Dockerfile +9 -19
  2. requirements.txt +2 -2
Dockerfile CHANGED
@@ -8,32 +8,22 @@ ENV PIP_NO_CACHE_DIR=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
8
  # Working directory
9
  WORKDIR /app
10
 
11
- # System deps (optional but useful)
12
- #RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
13
-
14
- # Copy and install Python deps first (better layer caching)
15
- #COPY requirements.txt .
16
  COPY requirements.txt /app/
17
- #RUN pip install -U pip && pip install --no-cache-dir -r requirements.txt
18
- RUN pip install --upgrade pip && pip install -r requirements.txt
 
19
 
20
  # Copy app code
21
- #COPY streamlit_app.py .
22
- # Copy only what you need for the app
23
  COPY streamlit_app.py /app/
24
  COPY README.md /app/
25
 
26
- # Hugging Face caches (writable on Spaces)
27
- #ENV HF_HOME=/tmp/huggingface HF_HUB_CACHE=/tmp/huggingface/hub
28
-
29
- # Streamlit defaults for Docker
30
- #ENV STREAMLIT_BROWSER_GATHERUSAGESTATS=false
31
-
32
- # (Optional) if you keep static assets, copy them here too
33
- # COPY assets/ /app/assets/
34
 
35
- # Expose the port that the Space will connect to
36
  EXPOSE 7860
37
 
38
- # Run Streamlit on 0.0.0.0:7860
39
  CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
8
  # Working directory
9
  WORKDIR /app
10
 
11
+ # Copy and install Python deps first
 
 
 
 
12
  COPY requirements.txt /app/
13
+
14
+ # Install packages without dependencies to avoid conflicts
15
+ RUN pip install --upgrade pip && pip install --no-deps -r requirements.txt && pip install streamlit==1.39.0 pandas==2.2.2 numpy==1.26.4 scikit-learn==1.4.2 scipy==1.11.4 joblib==1.4.2 huggingface_hub==0.25.1
16
 
17
  # Copy app code
 
 
18
  COPY streamlit_app.py /app/
19
  COPY README.md /app/
20
 
21
+ # Hugging Face caches
22
+ ENV HF_HOME=/tmp/huggingface
23
+ RUN mkdir -p /tmp/huggingface/hub
 
 
 
 
 
24
 
25
+ # Expose port
26
  EXPOSE 7860
27
 
28
+ # Run Streamlit
29
  CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
requirements.txt CHANGED
@@ -1,7 +1,7 @@
1
- streamlit==1.38.0
2
  pandas==2.2.2
3
  numpy==1.26.4
4
- scipy==1.11.4
5
  scikit-learn==1.4.2
 
6
  joblib==1.4.2
7
  huggingface_hub==0.25.1
 
1
+ streamlit==1.39.0
2
  pandas==2.2.2
3
  numpy==1.26.4
 
4
  scikit-learn==1.4.2
5
+ scipy==1.11.4
6
  joblib==1.4.2
7
  huggingface_hub==0.25.1