Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfiles: Install the mermaid CLI #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sameo
Copy link

@sameo sameo commented Dec 3, 2023

In order to include mermaid diagrams that are both github and asciidoc compatible, we need to include the mermaid-cli package.

With that CLI, we can convert github mermaid diagrams on the fly, as shown in riscv-non-isa/riscv-ap-tee-io#43

In order to include mermaid diagrams that are both github and asciidoc
compatible, we need to include the mermaid-cli package.

With that CLI, we can convert github mermaid diagrams on the fly, as
shown in riscv-non-isa/riscv-ap-tee-io#43

Signed-off-by: Samuel Ortiz <[email protected]>
@sameo
Copy link
Author

sameo commented Dec 3, 2023

cc @rpsene

@rpsene
Copy link
Collaborator

rpsene commented Dec 4, 2023

@sameo any specific reason to install version 9 instead of the latest one (10.6.1)?

@rpsene
Copy link
Collaborator

rpsene commented Dec 4, 2023

@sameo with the version 9 we have a problem with the Chromium dependency on arm64.

548.3 npm WARN deprecated [email protected]: < 19.4.0 is no longer supported 549.2 npm ERR! code 1 549.2 npm ERR! path /usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer 549.2 npm ERR! command failed 549.2 npm ERR! command sh -c node install.js 549.2 npm ERR! The chromium binary is not available for arm64. 549.2 npm ERR! If you are on Ubuntu, you can install with: 549.2 npm ERR! 549.2 npm ERR! sudo apt install chromium 549.2 npm ERR! 549.2 npm ERR! 549.2 npm ERR! sudo apt install chromium-browser 549.2 npm ERR! 549.2 npm ERR! ERROR: Failed to set up Chromium r1022525! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download. 549.2 npm ERR! Error 549.2 npm ERR! at handleArm64 (/usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:138:11) 549.2 npm ERR! at BrowserFetcher.download (/usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:285:13) 549.2 npm ERR! at async downloadBrowser (/usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:65:5) 549.2 549.2 npm ERR! A complete log of this run can be found in: 549.2 npm ERR! /root/.npm/_logs/2023-12-04T14_20_33_126Z-debug-0.log

@rpsene
Copy link
Collaborator

rpsene commented Dec 4, 2023

it works with the lasted version, though.

@sameo
Copy link
Author

sameo commented Dec 4, 2023

it works with the lasted version, though.

@rpsene Can you run mmdc --version with the latest version installed? For me it was installing fine but then would crash when invoked.

@rpsene
Copy link
Collaborator

rpsene commented Dec 5, 2023

@sameo is this the error you got? if so, this is caused given the LTS versions of npm and nodejs available on Ubuntu 22.04 are older than the one required by the latest version of mermaid.

`root@ea299882b049:/build# mmdc --version
file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:262
const svg = container.getElementsByTagName?.('svg')?.[0]
^

SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)`

When updating:

Screenshot 2023-12-05 at 16 47 01

I will test the updated container, if we succeed bulding the docs, I will push the update to install mermaid.

@rpsene
Copy link
Collaborator

rpsene commented Dec 5, 2023

@sameo build is OK. I will push the changes.

`git diff
diff --git a/Dockerfiles/ubuntu2204 b/Dockerfiles/ubuntu2204
index 2f67e44..4ec04fb 100644
--- a/Dockerfiles/ubuntu2204
+++ b/Dockerfiles/ubuntu2204
@@ -55,6 +55,11 @@ RUN export DEBIAN_FRONTEND=noninteractive &&
pygments.rb
rghost
rouge \

  • chromium
    ruby_dev && \

@rpsene
Copy link
Collaborator

rpsene commented Dec 6, 2023

Closing as it was implemented. e42baa5

@sameo ^

@rpsene rpsene closed this Dec 6, 2023
@sameo
Copy link
Author

sameo commented Dec 7, 2023

@rpsene It seems I still get the error. See:
https://github.com/riscv-non-isa/riscv-ap-tee-io/actions/runs/6984327830/job/19398768968

where mmdc fails with the same error you and me were seeing. Did you push your latest build?

@rpsene
Copy link
Collaborator

rpsene commented Dec 7, 2023

@sameo can you check the build result at https://github.com/riscv-non-isa/riscv-ap-tee-io/actions/runs/7128569198

I have updated the build process in that repo.

@rpsene rpsene reopened this Dec 7, 2023
@rpsene
Copy link
Collaborator

rpsene commented Dec 15, 2023

@sameo the resolution is still pending, I hope to finish the fix by next week as I finily identified the root cause.

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