From 91699e95ca9a5d9bebebbc7ab31aecbc5469db75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Tue, 19 Nov 2024 00:24:09 +0100 Subject: [PATCH] puppeteer configuration --- Dockerfile.ubuntu | 15 +++++++++++---- src/diagram.lua.patch | 11 +++++++++++ src/usr/local/share/puppeteer/config.json | 3 +++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/diagram.lua.patch create mode 100644 src/usr/local/share/puppeteer/config.json diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 5b2f55f..0079be1 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -4,7 +4,7 @@ RUN set -ex; \ \ deluser --remove-home ubuntu; \ \ - apt-get update; apt-get install -y \ + apt-get update; apt-get install --no-install-recommends --yes \ ghostscript \ inotify-tools \ make \ @@ -22,11 +22,15 @@ WORKDIR /docs ENTRYPOINT ["autodoc"] CMD ["-bw"] -FROM stage-base AS stage-diagrams +FROM stage-base AS stage-diagram + +ENV PUPPETEER_CACHE_DIR="/usr/local/share/puppeteer/cache" + +COPY src/diagram.lua.patch /usr/local/src/autodoc/diagram.lua.patch RUN set -ex; \ \ - apt-get update; apt-get install -y \ + apt-get update; apt-get install --no-install-recommends --yes \ libasound2t64 \ libatk1.0-0t64 \ libatk-bridge2.0-0t64 \ @@ -38,6 +42,7 @@ RUN set -ex; \ libxkbcommon0 \ libxrandr2 \ npm \ + patch \ ; rm -rf /var/lib/apt/lists/*; \ \ npm install --global @mermaid-js/mermaid-cli; \ @@ -45,4 +50,6 @@ RUN set -ex; \ wget \ --output-document='/usr/local/share/pandoc/filters/diagram.lua' \ 'https://raw.githubusercontent.com/pandoc-ext/diagram/refs/heads/main/_extensions/diagram/diagram.lua' \ - ; + ; \ + patch /usr/local/share/pandoc/filters/diagram.lua < /usr/local/src/autodoc/diagram.lua.patch; \ + rm /usr/local/src/autodoc/diagram.lua.patch; diff --git a/src/diagram.lua.patch b/src/diagram.lua.patch new file mode 100644 index 0000000..3e991d7 --- /dev/null +++ b/src/diagram.lua.patch @@ -0,0 +1,11 @@ +--- diagram.lua 2024-11-18 23:55:02.673989033 +0100 ++++ diagram.patched.lua 2024-11-19 00:10:14.359878550 +0100 +@@ -158,7 +158,7 @@ + write_file(infile, code) + pipe( + self.execpath or 'mmdc', +- {"--pdfFit", "--input", infile, "--output", outfile}, ++ {"--pdfFit", "--puppeteerConfigFile", "/usr/local/share/puppeteer/config.json", "--input", infile, "--output", outfile}, + '' + ) + return read_file(outfile), mime_type diff --git a/src/usr/local/share/puppeteer/config.json b/src/usr/local/share/puppeteer/config.json new file mode 100644 index 0000000..a701bc4 --- /dev/null +++ b/src/usr/local/share/puppeteer/config.json @@ -0,0 +1,3 @@ +{ + "args": [ "--no-sandbox" ] +}