Harshb11 commited on
Commit
567d707
Β·
verified Β·
1 Parent(s): 82e9ad4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -11
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Base image with Python 3.9 (lightweight)
2
  FROM python:3.9-slim
3
 
4
  # Prevent interactive prompts during package installs
@@ -7,7 +7,7 @@ ENV DEBIAN_FRONTEND=noninteractive
7
  # Set working directory
8
  WORKDIR /app
9
 
10
- # System dependencies (needed for nltk, matplotlib, wordcloud)
11
  RUN apt-get update && apt-get install -y \
12
  gcc \
13
  g++ \
@@ -22,24 +22,25 @@ RUN apt-get update && apt-get install -y \
22
  libgl1 \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
- # Copy requirements first (better caching)
26
  COPY requirements.txt .
27
 
28
- # Install Python dependencies
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
- # Download NLTK stopwords
32
  RUN python -m nltk.downloader stopwords
33
 
34
- # Copy source code
35
  COPY . .
36
 
37
- # Expose Streamlit default port
38
  EXPOSE 7860
39
 
40
- # Set environment for Streamlit
41
  ENV STREAMLIT_SERVER_PORT=7860 \
42
- STREAMLIT_SERVER_ADDRESS=0.0.0.0
 
43
 
44
- # Command to run Streamlit
45
- CMD ["streamlit", "run", "app.py"]
 
1
+ # βœ… Base image with Python 3.9 slim
2
  FROM python:3.9-slim
3
 
4
  # Prevent interactive prompts during package installs
 
7
  # Set working directory
8
  WORKDIR /app
9
 
10
+ # βœ… Install system dependencies (needed for matplotlib, wordcloud etc.)
11
  RUN apt-get update && apt-get install -y \
12
  gcc \
13
  g++ \
 
22
  libgl1 \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
+ # βœ… Copy requirements.txt first (cache optimization)
26
  COPY requirements.txt .
27
 
28
+ # βœ… Install Python dependencies
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
+ # βœ… Download NLTK stopwords at build time
32
  RUN python -m nltk.downloader stopwords
33
 
34
+ # βœ… Copy the source code into container
35
  COPY . .
36
 
37
+ # βœ… Expose Streamlit port
38
  EXPOSE 7860
39
 
40
+ # βœ… Environment variables for Streamlit
41
  ENV STREAMLIT_SERVER_PORT=7860 \
42
+ STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
43
+ STREAMLIT_BROWSER_GATHERUSAGESTATS=false
44
 
45
+ # βœ… Run Streamlit app
46
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]