Skip to content

feat: enhance Dockerfile for Playwright#6

Merged
hustcc merged 2 commits into
hustcc:mainfrom
2niuhe:dockerfile
Aug 2, 2025
Merged

feat: enhance Dockerfile for Playwright#6
hustcc merged 2 commits into
hustcc:mainfrom
2niuhe:dockerfile

Conversation

@2niuhe

@2niuhe 2niuhe commented Jul 31, 2025

Copy link
Copy Markdown
Contributor
  • Install system dependencies for Playwright including Chromium
  • The Alpine base image is not officially supported by Playwright,so switch to the Debian-based image for compatibility and stability.

- Install system dependencies for Playwright including Chromium and font packages.
- Configure Playwright to use the installed Chromium in Docker.
- Add a function to set the font family for Mermaid diagrams, supporting custom overrides and ensuring Chinese font compatibility.
Comment thread src/utils/render.ts Outdated
/**
* Get font family for Mermaid diagrams
*/
function getFontFamily(): string {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

这个是不是加到 tool 的配置中更好?而不是用 env 去设置。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

设置font family主要是考虑解决容器内中文和特殊字符无法渲染的问题,也可以改成命令行指定优先使用的字体,就是代码改动范围稍大。

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

mermaid 肯定有自己默认的字体,如果容器中出现字体问题应该是补齐容器中的字体文件吧!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

你说的对,测试了下不需要自定义字体顺序

Comment thread src/utils/render.ts Outdated
Comment thread Dockerfile Outdated
- Introduced .dockerignore to exclude unnecessary files from Docker context.
- Updated Dockerfile to streamline dependency installation and build process, including Playwright with system Chromium.
@2niuhe 2niuhe changed the title feat: enhance Dockerfile for Playwright and add font support feat: enhance Dockerfile for Playwright Aug 2, 2025
@2niuhe

2niuhe commented Aug 2, 2025

Copy link
Copy Markdown
Contributor Author

cc @hustcc simplify PR content

docker build -t mcp-mermaid .

# run with sse mode
docker run -dit -p 3033:3033 --name mermaid mcp-mermaid:latest node build/index.js -t sse

@hustcc hustcc merged commit 3808661 into hustcc:main Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants