feat: Dockerized release for non-JS environments#41
Conversation
Agent-Logs-Url: https://github.com/hustcc/mcp-mermaid/sessions/a464b1d1-980b-4c44-b630-5eacef975b8e Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a Docker-based distribution and publishing pipeline so mcp-mermaid can be run as a container (SSE by default) and consumed outside Node.js-centric environments, addressing Issue #34.
Changes:
- Update Docker usage docs to reference the canonical
ghcr.io/hustcc/mcp-mermaidimage and add MCP client + local build examples. - Extend
Dockerfileto expose port 3033 and provide a default SSECMD. - Add a GitHub Actions workflow to build and publish Docker images to GitHub Container Registry on
mainpushes andv*tags.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| README.md | Switch docs to GHCR image, add Docker-based SSE client config + local build instructions. |
| Dockerfile | Default container behavior to serve SSE on 3033 via CMD, and expose 3033. |
| .github/workflows/docker.yml | New CI workflow to build/push container images with metadata tags and GHA caching. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: | ||
| - 'v*' |
There was a problem hiding this comment.
This workflow only runs on pushes/tags and immediately pushes images; Dockerfile breakages won’t be detected until after merge. Consider adding a pull_request trigger that runs the same build steps with push: false (and optionally load: true) so Docker build failures are caught in CI before publishing.
| COPY . . | ||
|
|
||
| RUN npm install --ignore-scripts \ | ||
| && npm run build \ | ||
| && npx playwright install --with-deps chromium \ | ||
| && apt-get clean \ | ||
| && npm prune --omit=dev \ | ||
| && npm cache clean --force \ | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && rm -rf /var/cache/apt/* | ||
| && npm run build \ | ||
| && npx playwright install --with-deps chromium \ |
There was a problem hiding this comment.
Docker build caching is inefficient because COPY . . happens before npm install, so any source change invalidates the dependency layer and forces a full reinstall. Consider copying only package.json/lockfile first, running the install, then copying the rest of the source before npm run build.
| COPY . . | ||
|
|
||
| RUN npm install --ignore-scripts \ |
There was a problem hiding this comment.
This single-stage Docker build keeps the full repository (e.g., src/, tests, configs) in the final runtime image, increasing size and attack surface. Consider a multi-stage build (builder + runtime) that copies only build/ plus production dependencies into the final image, or explicitly remove source/test files after the build step.
| && rm -rf /var/lib/apt/lists/* \ | ||
| && rm -rf /var/cache/apt/* | ||
|
|
||
| EXPOSE 3033 |
There was a problem hiding this comment.
The image documents running streamable transport on port 1122, but the Dockerfile only exposes 3033. If you want docker run -P and tooling to work consistently for streamable mode too, consider also exposing 1122 (or documenting that 1122 must always be mapped explicitly).
| EXPOSE 3033 | |
| EXPOSE 3033 | |
| EXPOSE 1122 |
Issue #34 requests a Docker-based distribution to make mcp-mermaid usable outside Node.js environments. This adds a publish pipeline and cleans up the existing Dockerfile.
Changes
Dockerfile: Added
EXPOSE 3033and a defaultCMD— container now serves SSE on port 3033 with no extra arguments required:.github/workflows/docker.yml: New workflow publishing to GitHub Container Registry (ghcr.io/hustcc/mcp-mermaid) on pushes tomainandv*tags. Produceslatest, branch, and semver (x.y.z/x.y) tags with GHA layer caching.README.md: Updated Docker section to reference the canonical
ghcr.io/hustcc/mcp-mermaidimage (replacing the personalsusuperli/namespace), added MCP client config snippet for Docker-hosted SSE, and added local build instructions.{ "mcpServers": { "mcp-mermaid": { "url": "http://localhost:3033/sse" } } }Original prompt
This pull request was created from Copilot chat.
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.