Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -6
Dockerfile
CHANGED
@@ -1,18 +1,29 @@
|
|
1 |
-
# Use official Python image
|
2 |
-
FROM python:3.9
|
3 |
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
#
|
|
|
|
|
|
|
|
|
|
|
8 |
COPY requirements.txt .
|
9 |
RUN pip install --no-cache-dir -r requirements.txt
|
10 |
|
|
|
|
|
|
|
11 |
# Copy the entire application
|
12 |
COPY . .
|
13 |
|
14 |
-
#
|
|
|
|
|
|
|
15 |
EXPOSE 7860
|
16 |
|
17 |
-
# Command to run the application
|
18 |
-
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]
|
|
|
1 |
+
# Use a slimmer official Python image
|
2 |
+
FROM python:3.9-slim
|
3 |
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Install system dependencies (if needed for libraries like PyPDF2)
|
8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
+
gcc \
|
10 |
+
&& rm -rf /var/lib/apt/lists/*
|
11 |
+
|
12 |
+
# Copy requirements file and install Python dependencies
|
13 |
COPY requirements.txt .
|
14 |
RUN pip install --no-cache-dir -r requirements.txt
|
15 |
|
16 |
+
# Pre-download NLTK data to avoid runtime downloads
|
17 |
+
RUN python -m nltk.downloader -d /app/nltk_data punkt stopwords
|
18 |
+
|
19 |
# Copy the entire application
|
20 |
COPY . .
|
21 |
|
22 |
+
# Set environment variable for NLTK data path
|
23 |
+
ENV NLTK_DATA=/app/nltk_data
|
24 |
+
|
25 |
+
# Expose the application port (Spaces expects 7860)
|
26 |
EXPOSE 7860
|
27 |
|
28 |
+
# Command to run the application with Gunicorn
|
29 |
+
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "app:app"]
|