File size: 925 Bytes
35ada41
526d490
35ada41
56cadf1
7612ffb
 
 
56cadf1
7612ffb
 
526d490
35ada41
 
 
 
 
 
 
 
 
 
 
 
526d490
35ada41
 
 
 
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
# Use an official Python runtime as the base image
FROM python:3.9-slim

# Install system dependencies as root (including git for cloning repositories)
RUN apt-get update && apt-get install -y \
    libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev \
    libswscale-dev libswresample-dev libavfilter-dev \
    git \
    && rm -rf /var/lib/apt/lists/*

# Create a non-root user (Hugging Face Spaces requirement)
RUN useradd -m -u 1000 user
USER user
WORKDIR /app
ENV PATH="/home/user/.local/bin:$PATH"

# Copy requirements.txt and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of the application files
COPY --chown=user . /app

# Expose the port (Hugging Face Spaces default is 7860)
EXPOSE 7860

# Command to run the FastAPI app with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]