File size: 1,092 Bytes
689d01c
0dc4ee5
 
 
 
 
 
 
41410d8
0dc4ee5
 
 
41410d8
0dc4ee5
 
 
 
 
689d01c
0dc4ee5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
df7a9df
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.11-slim

# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Set the working directory to /app
WORKDIR /app

# Install system dependencies required for MediaPipe, OpenCV, and video processing
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# Copy the final requirements file into the container
COPY req_final.txt .

# Install dependencies using uv (Python 3.11 to match req_final.txt pins)
# Remove msvc-runtime since it is Windows-only
RUN sed -i '/msvc-runtime/d' req_final.txt && \
    uv pip install --system --no-cache -r req_final.txt gunicorn

# Copy all the backend files into the container
COPY . .

# Hugging Face Spaces required setup for permissions
RUN useradd -m -u 1000 user && \
    mkdir -p /app/static/outputs /app/static/uploads && \
    chown -R user:user /app
USER user

# HF Spaces bind to port 7860 by default for Docker spaces
ENV PORT=7860
EXPOSE 7860

# Run the Flask app using Gunicorn
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:7860", "--timeout", "300"]