Spaces:
Running
Running
| FROM python:3.11-slim | |
| # Switch to root to install ALL system dependencies including Playwright browser libs | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| espeak-ng \ | |
| portaudio19-dev \ | |
| python3-dev \ | |
| build-essential \ | |
| # ββ Playwright / Chromium system dependencies ββββββββββββββββββββββββββββββ | |
| libnss3 \ | |
| libnspr4 \ | |
| libatk1.0-0 \ | |
| libatk-bridge2.0-0 \ | |
| libcups2 \ | |
| libdrm2 \ | |
| libdbus-1-3 \ | |
| libxkbcommon0 \ | |
| libxcomposite1 \ | |
| libxdamage1 \ | |
| libxfixes3 \ | |
| libxrandr2 \ | |
| libgbm1 \ | |
| libasound2 \ | |
| libpango-1.0-0 \ | |
| libcairo2 \ | |
| libatspi2.0-0 \ | |
| libwayland-client0 \ | |
| wget \ | |
| ca-certificates \ | |
| # ββ S4: headless Blender runtime links (no X server needed in --background) β | |
| curl \ | |
| xz-utils \ | |
| libgl1 \ | |
| libegl1 \ | |
| libx11-6 \ | |
| libxi6 \ | |
| libxxf86vm1 \ | |
| libxrender1 \ | |
| libgomp1 \ | |
| libsm6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ββ S4: Blender 4.5 LTS headless (official Linux x64 tarball, URL verified 2026-07-17). | |
| # Geometry processing + GLB export only β no rendering β CPU hardware is sufficient. | |
| ARG BLENDER_VERSION=4.5.3 | |
| RUN mkdir -p /opt/blender && \ | |
| curl -fsSL "https://download.blender.org/release/Blender4.5/blender-${BLENDER_VERSION}-linux-x64.tar.xz" \ | |
| -o /tmp/blender.tar.xz && \ | |
| tar -xJf /tmp/blender.tar.xz -C /opt/blender --strip-components=1 && \ | |
| rm /tmp/blender.tar.xz && \ | |
| /opt/blender/blender --version | |
| # Set up a new user named "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # Switch to the "user" user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:/opt/blender:$PATH \ | |
| CLOUD_ENV=true \ | |
| PLAYWRIGHT_BROWSERS_PATH=/home/user/.playwright \ | |
| BLENDER_PATH=/opt/blender/blender | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Copy the requirements file and install dependencies | |
| COPY --chown=user backend/requirements.txt $HOME/app/backend/requirements.txt | |
| RUN awk '!/^#/ && NF' backend/requirements.txt | while read -r req; do \ | |
| req=$(echo "$req" | tr -d '\r'); \ | |
| echo "=== INSTALLING: $req ==="; \ | |
| pip install --no-cache-dir --upgrade "$req" || { echo "FAILED ON: $req"; exit 1; }; \ | |
| done | |
| # Install Playwright Chromium browser binaries (for social media automation) | |
| RUN playwright install chromium | |
| # Copy the rest of the backend source code | |
| COPY --chown=user backend/ $HOME/app/backend/ | |
| # Copy required root modules and config | |
| COPY --chown=user modules/ $HOME/app/modules/ | |
| COPY --chown=user config.py $HOME/app/config.py | |
| # S4: AR scene bus (started by backend.main at boot; /scene/ws proxies into it) | |
| COPY --chown=user phone/ $HOME/app/phone/ | |
| # Copy the centralized database with the vault keys | |
| COPY --chown=user memory.db $HOME/app/memory.db | |
| # ββ S4: ship the WebAR client β mobile AR loads straight from the Space at /webar/ | |
| COPY --chown=user webar/ $HOME/app/webar/ | |
| # ββ S4: writable pipeline dirs (container FS is ephemeral; durable copies are pushed | |
| # to the private OMEGA models dataset via huggingface_hub at runtime) | |
| RUN mkdir -p $HOME/app/storage/models3d $HOME/app/storage/forge_templates $HOME/app/storage/chroma_db | |
| # Expose the default port for Hugging Face Spaces | |
| EXPOSE 7860 | |
| # We use the Self-Healing Supervisor to boot the actual server | |
| CMD ["python", "-u", "backend/supervisor.py"] | |
| # S4 rebuild marker 2026-07-17 β Blender pipeline + WebAR serving | |