| FROM python:3.11-slim-bookworm | |
| # Install system dependencies for MuJoCo and OpenCV | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglx0 \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender1 \ | |
| libgomp1 \ | |
| libglfw3 \ | |
| libglew2.2 \ | |
| libosmesa6 \ | |
| libegl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code (including the static frontend directory) | |
| COPY . . | |
| # Enable GPU rendering for MuJoCo on HF (egl when GPU is available) | |
| ENV NOVA_MUJOCO_GPU=1 | |
| # Performance tuning | |
| ENV OMP_NUM_THREADS=4 | |
| ENV MKL_NUM_THREADS=4 | |
| # Hugging Face Spaces expects the app to bind to PORT (default 7860) | |
| ENV PORT=7860 | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run the server | |
| CMD ["python", "mujoco_server.py"] | |