# Dockerfile for Hugging Face Spaces FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ wget \ ffmpeg \ nodejs \ npm \ && rm -rf /var/lib/apt/lists/* # Install yt-dlp RUN pip install yt-dlp # Copy package files first for better caching COPY package*.json ./ # Install Node.js dependencies RUN npm install # Copy application files COPY . . # Create downloads directory with proper permissions RUN mkdir -p downloads && chmod 777 downloads # Create user for security RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app # Switch to non-root user USER appuser # Expose port 7860 (Hugging Face Spaces default) EXPOSE 7860 # Set environment variable for Hugging Face ENV PORT=7860 # Start the application CMD ["npm", "start"]