FROM python:3.10-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ redis-server \ && rm -rf /var/lib/apt/lists/* # Copy requirements file COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy only main.py (code will be downloaded from model repo) COPY main.py . # Expose port 7860 (required by Hugging Face Spaces) EXPOSE 7860 # Create a startup script RUN echo '#!/bin/bash\n\ redis-server --daemonize yes\n\ sleep 2\n\ python main.py\n\ ' > /start.sh && chmod +x /start.sh # Run the startup script CMD ["/start.sh"]