Spaces:
Build error
Build error
| # Infinigen Agents - Modern Python-based Terrain Engine | |
| # No legacy C++/CUDA compilation needed - uses HuggingFace Kernels + PyTorch Geometric | |
| FROM python:3.11-slim AS builder | |
| # Python environment setup for UV | |
| ENV UV_COMPILE_BYTECODE=1 | |
| ENV UV_LINK_MODE=copy | |
| ENV UV_CACHE_DIR=/tmp/.uv-cache | |
| # System dependencies (minimal - no CUDA toolkit needed) | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| curl \ | |
| ca-certificates \ | |
| git \ | |
| build-essential \ | |
| libopenblas-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install uv | |
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh | |
| ENV PATH="/root/.local/bin:/usr/local/bin:/usr/bin:/bin:$PATH" | |
| # Clone infinigen from GitHub | |
| RUN git clone https://github.com/bjoernbethge/infinigen.git /app | |
| # Set up working directory | |
| WORKDIR /app | |
| # Create virtual environment | |
| RUN uv venv /app/.venv | |
| ENV VIRTUAL_ENV=/app/.venv | |
| ENV PATH="/app/.venv/bin:$PATH" | |
| # Install torch first (needed for torch-scatter build) | |
| RUN sh -c "ulimit -n 4096 && uv pip install torch --index-url https://download.pytorch.org/whl/cpu" | |
| # Install Python dependencies (modern terrain engine uses kernels, torch_geometric, gpytorch) | |
| RUN sh -c "ulimit -n 4096 && uv sync --no-build-isolation" | |
| # Install Gradio and HuggingFace dependencies for Space | |
| RUN sh -c "ulimit -n 4096 && uv pip install gradio>=5.0.0 pydantic-ai[huggingface]>=1.0.8" | |
| # Create user | |
| RUN useradd -ms /bin/bash user && \ | |
| chown -R user:user /app | |
| # ============================================ | |
| # Runtime stage - minimal image | |
| # ============================================ | |
| FROM python:3.11-slim AS runtime | |
| # Runtime environment | |
| ENV UV_COMPILE_BYTECODE=1 | |
| ENV UV_CACHE_DIR=/tmp/.uv-cache | |
| # Minimal runtime dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| libopenblas0 \ | |
| libgomp1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create user (HuggingFace Spaces standard) | |
| RUN useradd -ms /bin/bash user | |
| # Copy built artifacts from builder stage | |
| COPY --from=builder /app /app | |
| COPY --from=builder /root/.local /root/.local | |
| # Set up environment | |
| ENV PATH="/app/.venv/bin:/root/.local/bin:/usr/local/bin:/usr/bin:/bin:$PATH" | |
| ENV VIRTUAL_ENV=/app/.venv | |
| ENV HOME=/home/user | |
| WORKDIR /app | |
| # Copy Gradio app | |
| COPY app.py /app/app.py | |
| # Set ownership | |
| RUN chown -R user:user /app | |
| # Switch to user | |
| USER user | |
| # Expose Gradio port | |
| EXPOSE 7860 | |
| # Start Gradio app | |
| CMD ["python", "app.py"] | |