Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: docker

on:
push:
branches: [main]
tags:
- 'v*'
Comment on lines +3 to +7

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ WORKDIR /app
COPY . .

RUN npm install --ignore-scripts \
Comment on lines 5 to 7

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
&& 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 \
Comment on lines 5 to +9

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
&& apt-get clean \
&& npm prune --omit=dev \
&& npm cache clean --force \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*

EXPOSE 3033

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
EXPOSE 3033
EXPOSE 3033
EXPOSE 1122

Copilot uses AI. Check for mistakes.

ENTRYPOINT ["node", "build/index.js"]

CMD ["--transport", "sse", "--port", "3033"]
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ Also, you can use it on aliyun, modelscope, glama.ai, smithery.ai or others with
- SSE: `http://localhost:3033/sse`
- Streamable: `http://localhost:1122/mcp`

**Available Docker Tags:**
- `susuperli/mcp-mermaid:latest` - Latest stable version
- View all available tags at [Docker Hub](https://hub.docker.com/repository/docker/susuperli/mcp-mermaid/tags)
**Available Docker Images:**
- `ghcr.io/hustcc/mcp-mermaid:latest` - Latest stable version (GitHub Container Registry)
- View all available tags at [GitHub Container Registry](https://github.com/hustcc/mcp-mermaid/pkgs/container/mcp-mermaid)


## 🚰 Run with SSE or Streamable transport
Expand Down Expand Up @@ -174,13 +174,32 @@ Run MCP Mermaid with Docker:

```bash
# Pull the image
docker pull susuperli/mcp-mermaid:latest
docker pull ghcr.io/hustcc/mcp-mermaid:latest

# Run with SSE transport (default)
docker run -p 3033:3033 susuperli/mcp-mermaid:latest --transport sse
docker run -p 3033:3033 ghcr.io/hustcc/mcp-mermaid:latest

# Run with streamable transport
docker run -p 1122:1122 susuperli/mcp-mermaid:latest --transport streamable --port 1122
docker run -p 1122:1122 ghcr.io/hustcc/mcp-mermaid:latest --transport streamable --port 1122
```

Use it as an MCP server over SSE in your MCP client configuration:

```json
{
"mcpServers": {
"mcp-mermaid": {
"url": "http://localhost:3033/sse"
}
}
}
```

To build the image locally from source:

```bash
docker build -t mcp-mermaid .
docker run -p 3033:3033 mcp-mermaid
```

## 📄 License
Expand Down
Loading