Spaces:
Sleeping
Sleeping
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"] | |