File size: 993 Bytes
00d05c7
 
 
 
eb7acae
00d05c7
 
8698f49
 
 
 
098ed86
8698f49
 
00d05c7
eb7acae
00d05c7
 
 
eb7acae
00d05c7
 
 
 
 
82a2435
 
 
f475695
04593d3
82a2435
 
 
 
 
 
e88e192
 
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
FROM python:3.10-slim

WORKDIR /app

# System deps (for ML libraries)
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1 \
    libgthread-2.0-0 \
    libglib2.0-0 \
    libcairo2 \
    libpango-1.0-0 \
    libgdk-pixbuf-xlib-2.0-0 \
    libffi-dev \
    && rm -rf /var/lib/apt/lists/*

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

# Copy repo code
COPY . .

# HF routes traffic to $PORT – bind to it
ENV PORT=7860 PYTHONUNBUFFERED=1

# Set environment variables for HF Spaces
ENV HF_HOME=/data
ENV DATA_ROOT=/data
ENV STUB_MODE=0

# Create writable directories and set permissions
RUN mkdir -p /data/outputs /data/artifacts && \
    chmod 755 /data && \
    chmod 755 /data/outputs && \
    chmod 755 /data/artifacts

# Use ENTRYPOINT instead of CMD to prevent Hugging Face from overriding
ENTRYPOINT ["gunicorn", "-w", "1", "-k", "gthread", "-t", "300", "-b", "0.0.0.0:7860", "backend.runner.app:app"]