Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

dockerfile - Combine two docker containers for sphinx+mermaid

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...