Looking for feedback on Docker or Podman
4 votes c/dokk Posted by zPlus — 4 votes, 3 commentsSource

I’ve started adding documentation to dokk. These projects use Sphinx so the building process is fairly easy: I install the dependencies and run sphinx-build for each release tag. What I don’t like about this process is that I’m installing all the dependencies together, system-wide. Some dependencies (or custom Sphinx extensions) are specific to single projects, and some builds require specific versions.

What I’d like to do is set up a constrained environment with all the dependencies where I can build the documentation. One environment for each project, such that the dependencies are not shared system-wide.

I’ve never used Docker or Podman before (beyond simple testing) but what I’m wondering is whether they can do this for me, and if I should use them. Or maybe there is a simpler solution which doesn’t involve using them?

PS: I’m developing dokk as it’s useful to me, but if there are other people out there interested in the database I’d love to develop the project in a direction that is useful to others. Just let me know!

I don’t exactly understand your needs, but it looks like you want to build some kind of artefact from source. This is a good use case for docker. You can write a Dockerfile so that docker build will produce a container that has all of the dependencies you need. You can then bind-mount the input and output dirs to the container and run sphinx-build. Remove that container and what is left is your artefact in the output dir.

Something along the lines of

# Dockerfile
FROM some-kind-of-base-image-like-alpine
RUN some-pkgmanager install list-of-dependencies
ENTRYPOINT ['sphinx-build']
CMD ['--help']
$ ls
Dockerfile
$ docker build -t my-builder .
$ docker run -v /path/to/inputdir:/path/to/inputdir -v /path/to/outputdir:/path/to/outputdir --name=an-instance-of-mybuilder my-builder /path/to/inputdir /path/to/outputdir
$ docker rm an-instance-of-mybuilder
$ ls /path/to/outputdir
such things

Yes, what I need is to build the documentation (output is HTML) from source (.rst files`). Thank you a lot for showing an example. I didn’t think I could link directories outside the container; instead I thought I had to copy the sources and artifacts in and out of the container.