Open sdavids opened 1 month ago
Even when setting XDG_CACHE_HOME
(see https://github.com/asciidoctor/docker-asciidoctor/issues/470#issuecomment-2344828843) the src/?
directory is still created.
So this has to be configured somewhere else.
$ mkdir -p /tmp/test && cd "$_"
$ mkdir src build
$ cat << 'EOF' >src/test.adoc
[plantuml]
----
@startuml
label Test
@enduml
----
EOF
$ docker run \
--rm \
-u "$(id -u):$(id -g)" \
-v '/tmp/test/src:/documents' \
-v '/tmp/test/build:/mnt/build' \
-e XDG_CACHE_HOME=/tmp \
asciidoctor/docker-asciidoctor:1.76.0 \
sh -c 'asciidoctor-pdf -D /mnt/build -r asciidoctor-diagram test.adoc'
$ tree -a --noreport /tmp/test
/tmp/test
├── build
│ ├── .asciidoctor
│ │ └── diagram
│ │ └── diag-plantuml-md5-e44a8461ee81fc745bd01cef0a04d9dc.png.cache
│ ├── diag-plantuml-md5-e44a8461ee81fc745bd01cef0a04d9dc.png
│ └── test.pdf
└── src
├── ?
│ └── .java
│ └── fonts
│ └── 17.0.12
│ └── fcinfo-1-a3cb5d7b7654-Alpine Linux-3.20.3-en-US.properties
└── test.adoc
$ echo "$(id -u):$(id -g)"
502:20
$ docker run --rm -u "$(id -u):$(id -g)" asciidoctor/docker-asciidoctor:1.76.0 whoami
whoami: unknown uid 502
$ docker run --rm -v '/tmp/test/src:/documents' -e XDG_CACHE_HOME=/tmp asciidoctor/docker-asciidoctor:1.76.0 sh -c 'adduser -D test && su -c "asciidoctor-pdf -r asciidoctor-diagram test.adoc" -- test && ls -AR /home/test'
/home/test:
.java
/home/test/.java:
fonts
/home/test/.java/fonts:
17.0.12
/home/test/.java/fonts/17.0.12:
fcinfo-1-1d1cec97232f-Alpine Linux-3.20.3-en-US.properties
So apparently asciidoctor-diagram/plantUML/JDK has to be configured somehow to not write in $HOME but in some other place.
Notice the creation of the
src/?
directory.I am not sure if it is a side-effect of #470.
Regardless, this directory should be created somewhere else so one can mount the
src
directory as readonly: