# Dockerfile — DemoPrep MCP Space (Hugging Face Docker Space) # # Runs the MCP server (mcp_server.py) over streamable-HTTP on port 7860. # This is a SEPARATE Space from the Gradio app: same codebase, different # entrypoint. Business logic stays in one place (demoprep_app/) — this Space # just runs the MCP adapter instead of the Gradio UI. # # Required secrets: set in Space Settings -> Repository Secrets (see the # mcp_server.py module docstring for the full list). FROM python:3.11-slim RUN useradd -m -u 1000 user WORKDIR /app # node + npm are required by the build_portal tool: the portal codemod is a Node # script and the site is built with vite. Debian bookworm ships Node 18, which # satisfies vite 5 (^18 || >=20). RUN apt-get update && apt-get install -y git curl nodejs npm \ && rm -rf /var/lib/apt/lists/* COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY --chown=user . . # Pre-install the portal template's node_modules AS ROOT, at image build time. # The codemod installs them on first use if absent — but the runtime user cannot # write into /app, so that would fail exactly like the 2026-08-25 PromptLogger # outage. Installing here means every portal build finds them ready. RUN cd demoprep_app/portal/template-tse \ && npm install --no-audit --no-fund --loglevel=error \ && chown -R user:user node_modules USER user ENV MCP_TRANSPORT=http \ MCP_HTTP_PORT=7860 \ HOME=/home/user EXPOSE 7860 CMD ["python", "mcp_server.py"]