Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +6 -10
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Use a
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
# Set working directory
|
@@ -7,19 +7,15 @@ WORKDIR /app
|
|
7 |
# Install system dependencies for PyPDF2, python-pptx, etc.
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
gcc \
|
10 |
-
libjpeg-dev \
|
11 |
-
zlib1g-dev \
|
12 |
-
libpng-dev \
|
13 |
-
libfreetype6-dev \
|
14 |
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
-
# Copy requirements file and install dependencies
|
17 |
-
COPY requirements.txt .
|
18 |
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
# Set a writable cache directory for Hugging Face models
|
21 |
ENV HF_HOME=/app/hf_cache
|
22 |
-
RUN mkdir -p /app/hf_cache
|
23 |
|
24 |
# Pre-download T5-Base model and tokenizer
|
25 |
RUN python -c "from transformers import T5Tokenizer, T5ForConditionalGeneration; T5Tokenizer.from_pretrained('t5-base'); T5ForConditionalGeneration.from_pretrained('t5-base')"
|
@@ -27,8 +23,8 @@ RUN python -c "from transformers import T5Tokenizer, T5ForConditionalGeneration;
|
|
27 |
# Copy the entire application
|
28 |
COPY . .
|
29 |
|
30 |
-
# Expose application port
|
31 |
EXPOSE 7860
|
32 |
|
33 |
-
# Run Gunicorn with logging
|
34 |
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "app:app"]
|
|
|
1 |
+
# Use a slimmer official Python image
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
# Set working directory
|
|
|
7 |
# Install system dependencies for PyPDF2, python-pptx, etc.
|
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 |
# Set a writable cache directory for Hugging Face models
|
17 |
ENV HF_HOME=/app/hf_cache
|
18 |
+
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
|
19 |
|
20 |
# Pre-download T5-Base model and tokenizer
|
21 |
RUN python -c "from transformers import T5Tokenizer, T5ForConditionalGeneration; T5Tokenizer.from_pretrained('t5-base'); T5ForConditionalGeneration.from_pretrained('t5-base')"
|
|
|
23 |
# Copy the entire application
|
24 |
COPY . .
|
25 |
|
26 |
+
# Expose the application port
|
27 |
EXPOSE 7860
|
28 |
|
29 |
+
# Run Gunicorn with logging
|
30 |
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "app:app"]
|