Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +19 -5
Dockerfile
CHANGED
|
@@ -2,6 +2,7 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
| 7 |
curl \
|
|
@@ -9,13 +10,26 @@ RUN apt-get update && apt-get install -y \
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
|
| 13 |
-
COPY
|
| 14 |
|
|
|
|
| 15 |
RUN pip3 install -r requirements.txt
|
| 16 |
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
curl \
|
|
|
|
| 10 |
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Copy requirements first to leverage Docker cache
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
|
| 16 |
+
# Install Python dependencies
|
| 17 |
RUN pip3 install -r requirements.txt
|
| 18 |
|
| 19 |
+
# Download NLTK data
|
| 20 |
+
RUN python3 -c "import nltk; nltk.download('stopwords'); nltk.download('wordnet'); nltk.download('omw-1.4')"
|
| 21 |
|
| 22 |
+
# Copy the application
|
| 23 |
+
COPY . .
|
| 24 |
|
| 25 |
+
# Create necessary directories
|
| 26 |
+
RUN mkdir -p models artifacts
|
| 27 |
+
|
| 28 |
+
# Expose port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Health check
|
| 32 |
+
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
|
| 33 |
+
|
| 34 |
+
# Run the application
|
| 35 |
+
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|