Skip to content

png export with docker container fails #2961

@mcpride

Description

@mcpride

Relates to

CLI

Version you are using

1.56.0, 1.57.0

Describe the issue

I cannot use the docker image for the png export. It seems, that playwright isn't initialized correctly:

docker run --rm -v $PWD:/data -t likec4/likec4:1.56.0 export png

08:51:47.433 INFO  likec4.lang layout binary
08:51:47.439 INFO  likec4.lang workspace: /data
08:51:47.490 INFO  likec4.server.projects add 'abc'
08:51:48.474 INFO  likec4.lang workspace: found 106 source files
---- SNIP ----
08:51:51.088 INFO  likec4.c4:export output /data/
08:51:51.088 INFO  likec4.c4:export base url http://172.17.0.2:5173/

08:51:51.237 INFO  likec4.c4:export Start chromium /root/.cache/ms-playwright/chromium-1217/chrome-linux64/chrome
08:51:51.242 INFO  likec4.c4:export stop server
likec4 export png [path]

export views to PNG

Arguments:
  path  <directory> with LikeC4 sources (default is current directory or 'LIKEC4_WORKSPACE' env)
                                                                                         [string] [default: "."]

Globals:
      --verbose      verbose logging                                                                   [boolean]
  -h, --help         Show help                                                                         [boolean]
  -v, --version      Show version number                                                               [boolean]
      --show-hidden  Show hidden options                                                               [boolean]

Options:
  -o, --outdir, --output        output directory for PNG files; if not specified, images are saved next to sourc
                                es                                                                      [string]
  -p, --project                 select LikeC4 project by name (e.g. "my-project") or by path            [string]
      --theme                   color-scheme to use, defaults to light                [choices: "light", "dark"]
      --dark                    use dark theme, shortcut for --theme=dark                              [boolean]
      --light                   use light theme, shortcut for --theme=light                            [boolean]
      --use-dot, --use-dot-bin  enabled in container, disable by --no-use-dot          [boolean] [default: true]
      --seq, --sequence         use sequence layout for dynamic views                                  [boolean]
      --flat, --flatten         flatten all images in outdir ignoring sources structure                [boolean]
  -f, --filter                  include views with ids matching given patterns
                                multiple patterns are combined wi
                                th OR                                                                    [array]
  -i, --ignore                  continue if export fails for some views                                [boolean]
  -t, --timeout                 timeout for playwright (in seconds)                       [number] [default: 15]
      --max-attempts            max attempts to export failing view, 1 means no retry      [number] [default: 3]
      --server-url              use this url instead of starting new likec4 server                      [string]
      --chromium-sandbox        enable chromium sandbox (see Playwright docs)         [boolean] [default: false]

Examples:
  likec4 export png
    Search for likec4 files in current directory and output PNG next to sources

  likec4 export png --theme dark -o ./png src/likec4
    Search for likec4 files in src/likec4 and output PNG with dark theme to png folder

  likec4 export png -f "team1*" -f "team2*" --flat -o ./png src/likec4
    Export views matching team1* or team2* only

  likec4 export png -f "use-case*" --sequence src/likec4
    Export views matching use-case* using sequence layout

browserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium_headless_shell-1217/chrome-headless-shell-linux64/chrome-headless-shell
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated.       ║
║ Please run the following command to download new browsers: ║
║                                                            ║
║     npx playwright install                                 ║
║                                                            ║
║ <3 Playwright Team                                         ║
╚════════════════════════════════════════════════════════════╝
    at exportViewsToPNG (/usr/local/lib/node_modules/likec4/dist/cli/index.mjs:257:722)
    at async runExportPng (/usr/local/lib/node_modules/likec4/dist/cli/index.mjs:258:1723)
    at async pngHandler (/usr/local/lib/node_modules/likec4/dist/cli/index.mjs:259:459)
    at async Object.handler (/usr/local/lib/node_modules/likec4/dist/cli/index.mjs:272:197) {
  name: 'Error'
}

If possible, include link to the playground with example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions