# Use official Python runtime as a parent image FROM python:3.10-slim # Set working directory WORKDIR /app # Install system dependencies required for OpenCV RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY server/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY server/ ./server/ COPY client/ ./client/ COPY models/ ./models/ # Create a non-root user for security (recommended for HF Spaces) RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Expose the port (Hugging Face Spaces uses 7860 by default) EXPOSE 7860 # Run the FastAPI server on port 7860 CMD ["uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "7860"]