detector / Dockerfile
Emannn2004's picture
Update Dockerfile
2eea5a6 verified
Raw History Blame Contribute Delete
776 Bytes
# Use official Python image
FROM python:3.12-slim
# Set work directory
WORKDIR /app
# Install system dependencies for OpenCV and FFmpeg
# libgl1-mesa-glx replaced with libgl1 in newer Debian
RUN apt-get update && apt-get install -y \
build-essential \
ffmpeg \
libsm6 \
libxext6 \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first (better caching)
COPY requirements.txt /app/
# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy all other files
COPY . /app
# Expose port 7860 (HF Spaces requirement)
EXPOSE 7860
# Command to run FastAPI on port 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]