# Use Python 3.11 slim image for smaller size FROM python:3.11-slim # Set working directory WORKDIR /app # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Install system dependencies if needed RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* # Copy all application files COPY . . # Create a non-root user for security RUN useradd -m -u 1000 user && chown -R user:user /app USER user # Expose the port that Hugging Face Spaces expects EXPOSE 7860 # Command to run the application on port 7860 (Hugging Face default) CMD ["python", "server.py", "--port", "7860"]