# 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 RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/* COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY --chown=user . . # Runtime-writable dirs. WORKDIR creates /app owned by root, and `logs/` is # gitignored so it is absent from the image — so the non-root `user` could not # mkdir it at runtime. That is exactly what took the MCP Space down on # 2026-08-25: PromptLogger's log_dir.mkdir() raised PermissionError: '/app/logs' # and every build returned failed. 4b87c36 made that non-fatal; this makes # logging actually work instead of silently degrading to memory-only. RUN mkdir -p /app/logs/prompts /app/results /app/demo_logs \ && chown -R user:user /app USER user ENV MCP_TRANSPORT=http \ MCP_HTTP_PORT=7860 \ HOME=/home/user EXPOSE 7860 CMD ["python", "mcp_server.py"]