Hamdy005 commited on
Commit
bb8d932
·
verified ·
1 Parent(s): 96bfc0a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -14
Dockerfile CHANGED
@@ -1,28 +1,32 @@
1
- # 1. Use official Python image
2
  FROM python:3.12-slim
3
 
4
- # 2. Set working directory
5
- WORKDIR /app
6
 
7
- # 3. Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # 4. Copy project files
13
- COPY . /app
14
 
15
- # 5. Install Python dependencies
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
- # 6. Download NLTK Data
19
- RUN python -m nltk.downloader wordnet stopwords
20
 
 
 
21
 
22
- # 7. Expose Streamlit Port
23
- EXPOSE 8501
24
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
25
 
 
 
 
26
 
27
- # 8. Run the Streamlit App
28
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ # Use a lightweight Python image
2
  FROM python:3.12-slim
3
 
4
+ # Set working directory
5
+ WORKDIR /code
6
 
7
+ # Install system dependencies (optional but useful)
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Copy all project files
13
+ COPY . /code
14
 
15
+ # Install Python dependencies
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
+ # Download NLTK data
19
+ RUN python -m nltk.downloader stopwords wordnet
20
 
21
+ # Hugging Face requires exposing port 7860 (even if Streamlit uses others)
22
+ EXPOSE 7860
23
 
24
+ # Streamlit by default runs on port 8501 — must override for HF Spaces
25
+ ENV PORT=7860
 
26
 
27
+ # Disable Streamlit telemetry & browser auto-open
28
+ ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
29
+ ENV STREAMLIT_SERVER_HEADLESS=true
30
 
31
+ # Command to run the app
32
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]