# Use a lightweight official Python image FROM python:3.10-slim # Prevent Python from writing .pyc files and buffering stdout/stderr ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Set the working directory WORKDIR /app # System dependencies (if you need more, add them here) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Copy dependency file first (for better layer caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the app COPY . . # Hugging Face Spaces expects the server to listen on $PORT ENV PORT=7860 # Expose the same port (for local dev and clarity) EXPOSE 7860 # Start the app # If your main file is not app.py, change this line accordingly CMD ["python", "app.py"]