I use sphinx
to generate LaTeX documentation. For this I have a docker setup which is based on python:slim
and which adds some TeX libraries etc and then uses pip
to install sphinx libraries:
FROM python:slim
RUN apt-get update && apt-get install -y --no-install-recommends
texlive-fonts-recommended
texlive-latex-extra-doc
prosper
texlive-latex-recommended-doc
texlive-latex-extra
latexmk
graphviz
RUN pip install sphinx sphinx_rtd_theme sphinx_materialdesign_theme sphinxcontrib-plantuml sphinx-autobuild recommonmark
This works fine. However, now I wanted to enable the sphinxcontrib-mermaid
plugin to sphinx, to render inline mermaid diagrams. For this to work, you also need the mermaid CLI, which in turn needs Node.JS, Chrome and a whole bunch of libraries.
I'm really a novice on Docker, so I got as far as trying to combine the two images using a second FROM
with FROM minlag/mermaid-cli as mermaid
, but I don't really understand how to then accomplish a container that has both python and the libraries listed above and everything described in the mermaid-cli image. I tried using COPY --from
to copy the mermaid directory from the mermaid image etc, but it doesn't really work since the system libraries won't be there. So while I guess using two FROM
statements doesn't build a single image with the combined dependencies, I realize I'm misunderstanding some basic concepts of docker here and don't really now how to proceed.
What is the correct way to do this? Is there a way to build an image combined from two others to end up with an image having python:slim
plus minlag/mermaid-cli
in the same image? Or should I manually build my own Dockerfile
with the merged contents of my original file with python and TeX plus all the dependencies from the mermaid image? Or should I somehow use docker-compose
to create a mermaid service or something?
question from:
https://stackoverflow.com/questions/65670741/combine-two-docker-containers-for-sphinxmermaid 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…