Skip to content

Commit

Permalink
Properly configure puppeteer
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Jan 22, 2025
1 parent 5733b7f commit 578e64d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .puppeteerrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": ["--no-sandbox"],
"cacheDirectory": "/puppeteer_cache"
}
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ if [ ${DEV_IMAGE} = false ] && echo ${TEXLIVE_TAG} | { ! grep -q latest-minimal;
then
apt-get -qy install --no-install-recommends ${PRODUCTION_DEPENDENCIES}
npm install -g @mermaid-js/mermaid-cli
sed -i "s/headless: 'shell'/&, cacheDirectory: '/puppeteer_cache', args: ['--no-sandbox']/" /usr/local/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js
cp ${BUILD_DIR}/.puppeteerrc.json /.puppeteerrc.json
mv ${BINARY_DIR}/mmdc ${BINARY_DIR}/mmdc.old
cat > ${BINARY_DIR}/mmdc <<-'ANOTHER_EOF'
#!/bin/bash
${BINARY_DIR}/mmdc.old -p /.puppeteerrc.json "$@"
ANOTHER_EOF
chmod +x ${BINARY_DIR}/mmdc
fi

# Update packages in non-historic TeX Live versions
Expand Down Expand Up @@ -219,7 +225,13 @@ elif echo ${TEXLIVE_TAG} | { ! grep -q latest-minimal; }
then
apt-get -qy install --no-install-recommends ${PRODUCTION_DEPENDENCIES}
npm install -g @mermaid-js/mermaid-cli
sed -i "s/headless: 'shell'/&, cacheDirectory: '/puppeteer_cache', args: ['--no-sandbox']/" /usr/local/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js
cp ${BUILD_DIR}/.puppeteerrc.json /.puppeteerrc.json
mv ${BINARY_DIR}/mmdc ${BINARY_DIR}/mmdc.old
cat > ${BINARY_DIR}/mmdc <<-'ANOTHER_EOF'
#!/bin/bash
${BINARY_DIR}/mmdc.old -p /.puppeteerrc.json "$@"
ANOTHER_EOF
chmod +x ${BINARY_DIR}/mmdc
fi
apt-get -qy autoclean
apt-get -qy clean
Expand Down

0 comments on commit 578e64d

Please sign in to comment.