# echo-mcp — containerized MCP server over the ECHO vault (docs/MCP-SERVER-SPEC.md).
# LEGACY Dockerfile format on purpose: the git.alwisp.com CI runner has no BuildKit
# (no `# syntax=` line, no RUN --mount).
FROM python:3.12-slim

WORKDIR /app

COPY mcp-server/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

# The canonical plugin scripts ARE the server's ops layer — vendored at build time,
# never a second source tree.
COPY echo-memory.plugin.src/skills/echo-memory/scripts /app/scripts
COPY mcp-server/app.py /app/app.py

ENV ECHO_STATE_DIR=/data \
    ECHO_MCP_PORT=8765 \
    PYTHONUNBUFFERED=1
VOLUME /data
EXPOSE 8765

# Probe 127.0.0.1, NOT localhost (::1-vs-IPv4 lesson from cpas/memer/breedr).
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
  CMD python3 -c "import urllib.request;urllib.request.urlopen('http://127.0.0.1:8765/health', timeout=4)" || exit 1

CMD ["python3", "/app/app.py"]
