File size: 596 Bytes
3745abe
 
 
 
 
3103298
3745abe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10-slim

# Install system dependencies for OpenCV
USER root
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Create a user to avoid running as root (Required by Hugging Face)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

# Copy files and ensure the new user owns them
COPY --chown=user . $HOME/app

RUN pip install --no-cache-dir --user -r requirements.txt

# Hugging Face Spaces always listens on port 7860
EXPOSE 7860

CMD ["python", "main.py"]