File size: 977 Bytes
0ea9e9b
 
400e20f
52bb265
 
 
 
 
 
 
 
 
 
 
 
 
400e20f
 
52bb265
400e20f
 
52bb265
 
400e20f
f82e0a6
 
 
400e20f
52bb265
400e20f
 
f82e0a6
 
 
52bb265
400e20f
 
52bb265
 
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
36
37
38
39
# Use official Python 3.11 slim image
FROM python:3.11-slim

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    POETRY_VIRTUALENVS_CREATE=false

# Install system dependencies for Python packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy only requirements first to leverage Docker cache
COPY requirements.txt .

# Upgrade pip and install Python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download NLTK resources
RUN python -m nltk.downloader punkt_tab


# Copy application code
COPY . .

# Tell NLTK where to find resources at runtime
ENV NLTK_DATA=/usr/local/nltk_data

# Expose port for FastAPI / Hugging Face Spaces
EXPOSE 7860

# Run FastAPI app with Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]