Skip to content

Commit

Permalink
docker: mount source and resources as read-only (#1724)
Browse files Browse the repository at this point in the history
This avoids writing output files into the source tree by changing the
imagesoutdir variable to point at the build tree. We can bind mount
source and docs-resources as read-only into the build directory and
then create symlinks to ensure the docker container sees the
appropriate directory layout.

Note: imagesoutdir must be an absolute path since otherwise
asciidoctor-mathemtical interprets it as a path relative to the source
dir rather than the current working directory (asciidoctor-diagram does
the expected thing and interprets it relative to the cwd).
  • Loading branch information
arichardson authored Nov 14, 2024
1 parent d438885 commit b796659
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ ifneq ($(SKIP_DOCKER),true)
DOCKER_CMD = \
docker run --rm \
-v ${PWD}/$@.workdir:/build${DOCKER_VOL_SUFFIX} \
-v ${PWD}/src:/src:ro \
-v ${PWD}/docs-resources:/docs-resources:ro \
-w /build \
$(DOCKER_USER_ARG) \
${DOCKER_IMG} \
Expand All @@ -58,7 +60,7 @@ endif
WORKDIR_SETUP = \
rm -rf $@.workdir && \
mkdir -p $@.workdir && \
cp -r src docs-resources $@.workdir
ln -sfn ../../src ../../docs-resources $@.workdir/

WORKDIR_TEARDOWN = \
mv $@.workdir/$@ $@ && \
Expand Down
2 changes: 1 addition & 1 deletion src/riscv-privileged.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include::../docs-resources/global-config.adoc[]
// Settings:
:experimental:
:reproducible:
:imagesoutdir: images
:imagesoutdir: {docdir}/../build/images-out
:bibtex-file: src/resources/riscv-spec.bib
:bibtex-order: alphabetical
:bibtex-style: apa
Expand Down
2 changes: 1 addition & 1 deletion src/riscv-unprivileged.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include::../docs-resources/global-config.adoc[]
// Settings:
:experimental:
:reproducible:
:imagesoutdir: images
:imagesoutdir: {docdir}/../build/images-out
:bibtex-file: src/resources/riscv-spec.bib
:bibtex-order: alphabetical
:bibtex-style: apa
Expand Down

0 comments on commit b796659

Please sign in to comment.