# OmniNPC — Hugging Face Spaces / Docker deployment # Single-port (7860) FastAPI server that hosts both the HTML game and the API. FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ PORT=7860 \ HOST=0.0.0.0 WORKDIR /app # System deps kept minimal — no audio/X11 libs needed because the HTML game is # rendered in the user's browser, not on the server. RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential curl \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . # Trim heavy/unneeded deps for the public API (Panda3D, Ursina, sound stack). # A separate requirements-server.txt is preferred long-term; for now we install # only what api_server.py imports. RUN pip install --upgrade pip && \ pip install \ openai>=1.30 \ pydantic>=2.0 \ fastapi>=0.110 \ uvicorn>=0.29 \ python-dotenv>=1.0 \ pyyaml>=6.0 \ httpx>=0.27 \ Pillow>=10.0 \ aiofiles>=23.0 COPY . . EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ CMD curl -fsS http://localhost:${PORT}/health || exit 1 CMD ["sh", "-c", "python api_server.py --port ${PORT} --host ${HOST}"]