File size: 1,019 Bytes
916aef5
0ad9cc2
14243c9
83be853
14243c9
 
14d96da
0ad9cc2
 
916aef5
 
 
 
0ad9cc2
 
916aef5
00ff2f5
 
 
f969157
 
 
 
 
 
 
83be853
14243c9
 
916aef5
6a0670c
 
916aef5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use a slim official Python image
FROM python:3.9-slim

# Set working directory
WORKDIR /app

# Install system dependencies for PyPDF2, python-pptx, etc.
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc \
    libjpeg-dev \
    zlib1g-dev \
    libpng-dev \
    libfreetype6-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Set a writable cache directory for Hugging Face models
ENV HF_HOME=/app/hf_cache
RUN mkdir -p /app/hf_cache

# Pre-download T5-Base model and tokenizer
RUN python -c "from transformers import T5Tokenizer, T5ForConditionalGeneration; T5Tokenizer.from_pretrained('t5-base'); T5ForConditionalGeneration.from_pretrained('t5-base')"

# Copy the entire application
COPY . .

# Expose application port
EXPOSE 7860

# Run Gunicorn with logging (2 workers for concurrency)
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "app:app"]