# Retakes — Space Docker, CPU uniquement. # Le seul GPU du pipeline est celui de fal, appelé avec la clé du visiteur. # Ici : MediaPipe (visage), chromium headless + three.js (tête 3D, rasterisation # logicielle swiftshader), ffmpeg (fenêtre, recollage). FROM python:3.11-slim ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ HOME=/home/user \ XDG_CACHE_HOME=/tmp/cache \ MPLCONFIGDIR=/tmp/cache/mpl \ FONTCONFIG_PATH=/etc/fonts \ PLAYWRIGHT_BROWSERS_PATH=/opt/pw-browsers \ GRADIO_SERVER_NAME=0.0.0.0 \ GRADIO_SERVER_PORT=7860 \ HOME=/home/user RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg curl ca-certificates gnupg \ && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ && apt-get install -y --no-install-recommends nodejs \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # three.js + chromium. `--with-deps` a besoin de root : on le fait AVANT de # basculer sur l'utilisateur 1000 (exigence des Spaces). COPY derisk/package.json ./derisk/package.json RUN cd derisk && npm install --omit=dev --no-audit --no-fund \ && npx playwright install --with-deps chromium \ && chmod -R a+rX /opt/pw-browsers # Sans ces caches inscriptibles, matplotlib et fontconfig inondent les logs du # Space (« No writable cache directories ») à chaque rendu. RUN mkdir -p /tmp/cache/mpl && chmod -R 777 /tmp/cache RUN useradd -m -u 1000 user COPY --chown=user:user . /app RUN chown -R user:user /app USER user EXPOSE 7860 # Le chargeur est le seul point d'entrée public : il télécharge la charge utile # depuis un dépôt HF privé, puis lance app.py. En développement local, app.py # est déjà là et le chargeur le lance directement — même commande partout. CMD ["python", "loader.py"]