Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -11
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Base image with Python 3.9
|
| 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 |
-
#
|
| 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 (
|
| 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
|
| 38 |
EXPOSE 7860
|
| 39 |
|
| 40 |
-
#
|
| 41 |
ENV STREAMLIT_SERVER_PORT=7860 \
|
| 42 |
-
STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
|
|
|
| 43 |
|
| 44 |
-
#
|
| 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"]
|