File size: 737 Bytes
0c5da5d
 
 
840a4d4
 
 
 
0c5da5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7da846e
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
# Use a small but recent base
FROM python:3.10-slim

# Create writable tmp directory early (HF Spaces requirement)
RUN mkdir -p /tmp && chmod -R 777 /tmp
ENV TMPDIR=/tmp

# Allow apt installs for system deps (opencv needs libgl1, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy requirements first (for caching)
COPY requirements.txt .

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

# Copy app code
COPY . .

# Expose the port Spaces expects by default
EXPOSE 7860

# Run uvicorn on port 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]