File size: 923 Bytes
f6f98ea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
40
41
FROM python:3.12.6

# Install OpenGL dependencies, PortAudio and additional dependencies for Gradio
USER root
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    portaudio19-dev \
    ffmpeg \
    libsm6 \
    libxext6 \
    libxrender-dev

# Create non-root user
RUN useradd -m -u 1000 user

WORKDIR /app

# Set PATH for the non-root user
ENV PATH="/home/user/.local/bin:$PATH"

# Switch to non-root user
USER user

# Copy both requirement files
COPY --chown=user ./requirements.txt requirements.txt
COPY --chown=user ./gradio_requirements.txt gradio_requirements.txt

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

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

# Expose the Hugging Face Spaces default port
EXPOSE 7860

# Set the command to run the Gradio app
CMD ["python", "gradio_app.py"]