FROM python:3.12-alpine # Set the working directory WORKDIR /app # Install required system packages RUN apt-get update && \ apt-get install -y ffmpeg && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Create a non-root user RUN useradd -m -u 1000 appuser # Copy requirements and install Python packages COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the application files COPY . . # Set permissions for all files and directories RUN find /app -type f -exec chmod 644 {} \; && \ find /app -type d -exec chmod 755 {} \; && \ chmod 644 www.youtube.com_cookies.txt && \ chown -R appuser:appuser /app # Switch to non-root user USER appuser # Expose the application port EXPOSE 7860 # Command to run the application CMD ["python", "srv.py"]