Skip to content

SVG rendering inconsistency when running on Linux in Docker #6

Description

@TomerAberbach

Not sure if this is a mermaid-isomorphic issue or a Playwright issue, but I'm encountering a rendering issue that only occurs when deploying my website to fly.io, which runs on Linux in Docker. When I build my website locally on my Mac for production the issue doesn't occur.

Locally:
Screenshot 2024-09-10 at 1 21 25 PM

On Fly (live blog link):
Screenshot 2024-09-10 at 1 21 40 PM

My guess is that Playwright is rendering the font slightly differently than a normal headful browser, so the box sizes it sets for the SVGs end up being incorrect when viewed in a headful browser.

Wondering if you have any ideas for what I should try? Appreciate any insights you have! Further details below.


My website code that uses mermaid-isomorphic (through rehype-mermaid):
https://github.com/TomerAberbach/website/blob/main/src/services/posts/parse/convert.server.ts#L181-L188

My Dockerfile:
https://github.com/TomerAberbach/website/blob/main/Dockerfile

I confirmed that I have all of the necessary Playwright dependencies installed in the container. Playwright will print a warning if you are missing some dependencies, and it stopped printing out warnings once I installed them all. Example deployment log:
https://github.com/TomerAberbach/website/actions/runs/10798633747/job/29952544461

Note that I confirmed the fonts are actually getting loaded in the deployed version. I patched mermaid-isomorphic locally and added some logging. I confirmed that "Kantumruy Pro" is printed out as one of the loaded fonts when the server starts up.

I also tried with and without PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW=1 and it didn't make a difference.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions