FROM python:3.10.4 # Install fakeroot, python3, and patch apt-get RUN apt-get update && apt-get install -y fakeroot python3 python3-pip && \ 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 RUN apt-get update && apt-get install -y \ git \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # 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) /usr/src/app && \ chown -R user:user /usr/src/app # Set working directory WORKDIR /usr/src/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 # Optional: install gradio + uvicorn RUN pip install --no-cache-dir gradio[oauth,mcp]==5.34.0 uvicorn spaces flask pyrogram EXPOSE 7860 CMD python3 --version && python3 app.py