The requirement of java & graphviz is a bit onerous and unnecessary in the world of Docker.
There are many unofficial plantuml Docker images out there: https://hub.docker.com/search?q=plantuml&type=image
Can you please publish an official plantuml Docker image that allow for GUI operation? You can steal from any of the existing Docker images found in the search above, or start with:
FROM openjdk:14-buster
ARG PLANTUML_VERSION=1.2020.6
ENV LANG en_US.UTF-8
RUN \
apt update && \
apt install -yy --no-install-recommends \
graphviz wget ca-certificates fonts-dejavu-core fontconfig xorg libgl1-mesa-glx && \
apt clean
RUN wget "http://downloads.sourceforge.net/project/plantuml/${PLANTUML_VERSION}/plantuml.${PLANTUML_VERSION}.jar" -O plantuml.jar
RUN ["java", "-jar", "plantuml.jar", "-version"]
RUN ["dot", "-version"]
ENTRYPOINT ["java", "-jar", "/plantuml.jar"]
CMD ["-help"]
Save the above to a file called Dockerfile, then run
docker build -f Dockerfile -t plantuml .
in the directory containing Dockerfile. I run it with the following script ('nix only):
#!/usr/bin/env sh
THIS_DIR="$(cd "$(dirname "$0")"; pwd)"
IMAGE=${IMAGE:-plantuml}
PLANTUML_ARGS=${*:--gui -tsvg -o .}
FULL_ARGS=${FULL_ARGS:-$JAVA_OPTS -jar /plantuml.jar $PLANTUML_ARGS}
IF=${IF:-en0}
docker run --rm -i \
-v "$THIS_DIR":/cwd -w /cwd \
-e DISPLAY="$(ifconfig $IF | egrep '^\s*inet ' | cut -d' ' -f2):0" \
--entrypoint "java" \
$IMAGE $FULL_ARGS
It launches the file open dialog ok, but when I double-click on an entry, nothing happens, and when I use the down arrow then enter to open one, I get the error at the end of this message.
It would be great if y'all could finish this up.
Exception:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:240)
at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:226)
at net.sourceforge.plantuml.swing.ImageWindow2.buildScrollablePicture(ImageWindow2.java:343)
...