File size: 821 Bytes
26c92d2
cc0add4
 
26c92d2
 
 
 
 
 
cc0add4
26c92d2
 
 
 
 
 
 
cc0add4
26c92d2
 
cc0add4
26c92d2
 
cc0add4
26c92d2
 
 
 
 
 
 
 
cc0add4
26c92d2
 
 
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
# Use lightweight Python base
FROM python:3.11-slim

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HOME=/tmp/huggingface \
    TRANSFORMERS_CACHE=/tmp/huggingface \
    HF_HUB_CACHE=/tmp/huggingface

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

# Create working directory
WORKDIR /app

# Copy requirements (create a requirements.txt alongside app.py)
COPY requirements.txt .

# Install Python deps
RUN pip install --upgrade pip \
    && pip install -r requirements.txt

# Copy the source code
COPY . .

# Expose HF Spaces port
EXPOSE 7860

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