File size: 702 Bytes
faaa354
8b3c32f
 
b079300
 
8b3c32f
faaa354
 
 
 
 
b079300
8b3c32f
b079300
 
8b3c32f
 
b079300
8b3c32f
 
b079300
 
 
faaa354
8b3c32f
 
faaa354
8b3c32f
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
# Use official Python image
FROM python:3.9-slim

# Set working directory inside user-writable space (IMPORTANT for Hugging Face Spaces)
WORKDIR /home/user/app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first for cache efficiency
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy full application
COPY . .

# Set environment variable to avoid writing to /root
ENV TRANSFORMERS_CACHE=/home/user/app/.cache

# Expose FastAPI port
EXPOSE 7860

# Run the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]