Spaces:
Build error
Build error
# Use a base image with CUDA 11.8 and Ubuntu 22.04 | |
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 | |
# Avoid prompts from apt | |
ENV DEBIAN_FRONTEND=noninteractive | |
# Install system dependencies for Python, Git, FFmpeg, and OpenCV | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
python3-pip \ | |
python3-dev \ | |
git \ | |
ffmpeg \ | |
libgl1-mesa-glx \ | |
libglib2.0-0 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create a non-root user | |
RUN useradd -m -u 1000 user | |
USER user | |
WORKDIR /app | |
ENV PATH="/home/user/.local/bin:$PATH" | |
# Copy and install Python requirements | |
COPY --chown=user requirements.txt . | |
RUN python3 -m pip install --upgrade pip | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the application code | |
COPY --chown=user . /app | |
# Expose the port and run the app | |
EXPOSE 7860 | |
CMD ["python3", "app.py"] |