# Use an official Python runtime as a parent image FROM python:3.11-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Set the working directory WORKDIR /workspace # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (to leverage Docker caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Copy the rest of the application files COPY . . # Expose port 7860 (port used by Hugging Face Spaces) EXPOSE 7860 # Start the server using uvicorn and the ASGI wrapper CMD ["python", "app.py"]