puppeteer configuration

This commit is contained in:
Jörn-Michael Miehe 2024-11-19 00:24:09 +01:00
parent f3219e9477
commit 91699e95ca
3 changed files with 25 additions and 4 deletions

View file

@ -4,7 +4,7 @@ RUN set -ex; \
\ \
deluser --remove-home ubuntu; \ deluser --remove-home ubuntu; \
\ \
apt-get update; apt-get install -y \ apt-get update; apt-get install --no-install-recommends --yes \
ghostscript \ ghostscript \
inotify-tools \ inotify-tools \
make \ make \
@ -22,11 +22,15 @@ WORKDIR /docs
ENTRYPOINT ["autodoc"] ENTRYPOINT ["autodoc"]
CMD ["-bw"] 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; \ RUN set -ex; \
\ \
apt-get update; apt-get install -y \ apt-get update; apt-get install --no-install-recommends --yes \
libasound2t64 \ libasound2t64 \
libatk1.0-0t64 \ libatk1.0-0t64 \
libatk-bridge2.0-0t64 \ libatk-bridge2.0-0t64 \
@ -38,6 +42,7 @@ RUN set -ex; \
libxkbcommon0 \ libxkbcommon0 \
libxrandr2 \ libxrandr2 \
npm \ npm \
patch \
; rm -rf /var/lib/apt/lists/*; \ ; rm -rf /var/lib/apt/lists/*; \
\ \
npm install --global @mermaid-js/mermaid-cli; \ npm install --global @mermaid-js/mermaid-cli; \
@ -45,4 +50,6 @@ RUN set -ex; \
wget \ wget \
--output-document='/usr/local/share/pandoc/filters/diagram.lua' \ --output-document='/usr/local/share/pandoc/filters/diagram.lua' \
'https://raw.githubusercontent.com/pandoc-ext/diagram/refs/heads/main/_extensions/diagram/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;

11
src/diagram.lua.patch Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
{
"args": [ "--no-sandbox" ]
}