Skip to content

Commit d484a47

Browse files
Merge pull request #534 from SKaiNET-developers/fix/docs-mermaid-crashpad-home
Set HOME=/tmp in Antora image so chromium crashpad can launch
2 parents 322f0cc + 739611d commit d484a47

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

docs/.docker/Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ LABEL org.opencontainers.image.title="SKaiNET Antora" \
77
# Chromium for mermaid-cli (puppeteer)
88
RUN apk add --no-cache chromium font-noto
99

10+
# HOME=/tmp: chromium's crashpad handler writes its database under $HOME and
11+
# aborts with `chrome_crashpad_handler: --database is required` when the
12+
# container runs as `--user $(id -u):$(id -g)` and $HOME falls back to `/`
13+
# (no passwd entry, not writable). Same motivation as runtime.cache_dir in
14+
# antora-playbook.yml.
1015
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
11-
PUPPETEER_SKIP_DOWNLOAD=true
16+
PUPPETEER_SKIP_DOWNLOAD=true \
17+
HOME=/tmp
1218

1319
# Install Antora + mermaid-cli into /opt/antora (not /antora which gets
1420
# volume-mounted at run time). asciidoctor-kroki is intentionally NOT
@@ -37,10 +43,14 @@ RUN echo '{ \
3743
# Antora playbook can reference it without any volume-mount gymnastics.
3844
COPY local-mermaid-extension.js /opt/antora/local-mermaid-extension.js
3945

40-
# Verify mermaid-cli works end to end at image build time.
46+
# Verify mermaid-cli works end to end at image build time. The cleanup
47+
# also removes mode-0700 root-owned dirs (e.g. /tmp/.config/puppeteer,
48+
# /tmp/.local/share/chromium) that puppeteer/chromium drop into $HOME
49+
# during this run — leaving them in place would make cosmiconfig EACCES
50+
# when the container is later launched with a non-root --user.
4151
RUN echo 'graph TD; A-->B;' > /tmp/test.mmd \
4252
&& npx mmdc -i /tmp/test.mmd -o /tmp/test.svg -p /opt/antora/puppeteer-config.json \
43-
&& rm /tmp/test.mmd /tmp/test.svg
53+
&& rm -rf /tmp/test.mmd /tmp/test.svg /tmp/.config /tmp/.local /tmp/.npm /tmp/.cache
4454

4555
ENTRYPOINT ["/opt/antora/node_modules/.bin/antora"]
4656
CMD ["--stacktrace", "antora-playbook.yml"]

0 commit comments

Comments
 (0)