FROM python:3.10-slim # Install fakeroot and patch apt-get RUN apt-get update && apt-get install -y fakeroot && \ mv /usr/bin/apt-get /usr/bin/.apt-get && \ echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get "$@"' > /usr/bin/apt-get && \ chmod +x /usr/bin/apt-get && \ rm -rf /var/lib/apt/lists/* && \ useradd -m -u 1000 user # Install base Python deps RUN echo "deb http://deb.debian.org/debian bookworm main non-free" > /etc/apt/sources.list && \ echo "deb http://deb.debian.org/debian-security bookworm-security main non-free" >> /etc/apt/sources.list && \ apt-get update && \ apt-get install -y --no-install-recommends \ apt-transport-https \ ca-certificates \ debian-archive-keyring \ unzip \ unar \ p7zip-full \ rar \ unrar \ locales \ libarchive-tools \ liblzma-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Install system dependencies RUN apt-get update && apt-get install -y \ git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx curl && \ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y nodejs && \ rm -rf /var/lib/apt/lists/* && \ git lfs install # Clone the repository using the secret mm and set permissions RUN --mount=type=secret,id=mm,mode=0444,required=true \ git clone $(cat /run/secrets/mm) /home/user/app && \ chown -R user:user /home/user/app # Set working directory WORKDIR /home/user/app # Install packages from packages.txt (cloned from the repository) RUN apt-get update && \ if [ -f packages.txt ]; then xargs -r -a packages.txt apt-get install -y; fi && \ rm -rf /var/lib/apt/lists/* && apt-get clean # Install Python requirements from the cloned requirements.txt RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; else echo "requirements.txt not found, skipping"; fi # Manually install specified Python packages RUN pip install --no-cache-dir \ pyrogram==2.0.106 # Optional: install gradio + uvicorn RUN pip install --no-cache-dir gradio[oauth,mcp]==5.34.0 uvicorn spaces flask # Expose Flask or Gradio port EXPOSE 7860 # Run your app CMD ["python", "app.py"]