Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -8
Dockerfile
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
FROM python:3.13-slim
|
| 2 |
|
| 3 |
-
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
-
|
| 7 |
ENV HOME=/app
|
| 8 |
ENV XDG_CONFIG_HOME=/app/.streamlit
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
RUN apt-get update && apt-get install -y \
|
| 12 |
build-essential \
|
| 13 |
curl \
|
|
@@ -15,10 +16,11 @@ RUN apt-get update && apt-get install -y \
|
|
| 15 |
git \
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
-
|
| 19 |
RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
COPY requirements.txt ./
|
| 23 |
COPY src/ ./src/
|
| 24 |
COPY src/c_d.csv ./src/
|
|
@@ -26,14 +28,17 @@ COPY src/logistic_models.pkl ./src/
|
|
| 26 |
COPY src/tfidf.pkl ./src/
|
| 27 |
COPY src/multilabels.pkl ./src/
|
| 28 |
|
| 29 |
-
|
| 30 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 31 |
|
|
|
|
|
|
|
| 32 |
|
|
|
|
| 33 |
EXPOSE 8501
|
| 34 |
|
| 35 |
-
|
| 36 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 37 |
|
| 38 |
-
|
| 39 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
FROM python:3.13-slim
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Set environment variables
|
| 7 |
ENV HOME=/app
|
| 8 |
ENV XDG_CONFIG_HOME=/app/.streamlit
|
| 9 |
+
ENV NLTK_DATA=/app/nltk_data
|
| 10 |
|
| 11 |
+
# Install system dependencies
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
build-essential \
|
| 14 |
curl \
|
|
|
|
| 16 |
git \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Create necessary directories
|
| 20 |
RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
|
| 21 |
+
RUN mkdir -p /app/nltk_data
|
| 22 |
|
| 23 |
+
# Copy files
|
| 24 |
COPY requirements.txt ./
|
| 25 |
COPY src/ ./src/
|
| 26 |
COPY src/c_d.csv ./src/
|
|
|
|
| 28 |
COPY src/tfidf.pkl ./src/
|
| 29 |
COPY src/multilabels.pkl ./src/
|
| 30 |
|
| 31 |
+
# Install Python dependencies
|
| 32 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 33 |
|
| 34 |
+
# Download NLTK data during build
|
| 35 |
+
RUN python -m nltk.downloader punkt averaged_perceptron_tagger wordnet stopwords
|
| 36 |
|
| 37 |
+
# Expose Streamlit port
|
| 38 |
EXPOSE 8501
|
| 39 |
|
| 40 |
+
# Add healthcheck
|
| 41 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 42 |
|
| 43 |
+
# Run the app
|
| 44 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|