Draw.io is a Security-first diagramming for teams. And we can run our own draw.io
server with Docker
.
But unfortunately, there is no arm/v7
version. There is an similar question on the GitHub
. So I try to build it and answer that question.
I have solved this question and built an arm/v7
version, which run on my arm/v7
platform successfully.
I pushed it at Docker Hub.
Anyone can use the arm/v7
version with docker pull welywely/drawio
How can I build the arm/v7 version
First, git clone https://github.com/jgraph/docker-drawio.git
The Dockerfile
is at docker-drawio-dev/main/Dockerfile
Then docker build --platform linux/arm/v7 -t welywely/drawio:latest --push .
I tried to change FROM openjdk:11-jdk-slim AS build
to FROM adoptopenjdk/openjdk11:armv7l-debianslim-jdk-11.0.23_9-slim AS build
in the first line to support arm/v7
and run build.
Then I meet this error.
Buildfile: /tmp/drawio/etc/build/build.xml
merge:
[jscomp] Compiling 1 file(s) with 112 extern(s)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#SIGBUS (0x7) at pc=0x413ee354, pid=28, tid=101
#
# JRE version: OpenJDK Runtime Environment Temurin-11.0.23+9 (11.0.23+9) (build 11.0.23+9)
# Java VM: OpenJDK Server VM Temurin-11.0.23+9 (11.0.23+9, mixed mode, g1 gc, linux-)
# Problematic frame:
#V[libjvm.so+0xa63354]
#
#No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /tmp/drawio/etc/build/hs_err_pid28.log
#
# If you would like to submit a bug report, please visit:
# https://github.com/adoptium/adoptium-support/issues
#
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
I tried other similar images, but no one worked.
Solution
Run the following command outside the docker to get the draw.war
, which means run in the system directly.
git clone --depth 1 https://github.com/jgraph/drawio.git
cd drawio/etc/build/
ant war
Copy the draw.war
at drawio/build/draw.war
to docker-drawio-dev/main/
, which is the same contents with Dockerfile
.
Then change COPY --from=build /tmp/drawio/build/draw.war /tmp
to COPY draw.war /tmp
in the Dockerfile
and delete the command line before FROM tomcat:9-jre11
.
Now the Dockerfile
only has these commands.
FROM tomcat:9-jre11
LABEL maintainer="JGraph Ltd" \
org.opencontainers.image.authors="JGraph Ltd" \
org.opencontainers.image.url="https://www.drawio.com" \
org.opencontainers.image.source="https://github.com/jgraph/docker-drawio"
ENV RUN_USER tomcat
ENV RUN_GROUP tomcat
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
certbot \
curl \
xmlstarlet \
unzip && \
apt-get autoremove -y --purge && \
apt-get clean && \
rm -r /var/lib/apt/lists/*
COPY draw.war /tmp
# Extract draw.io war & Update server.xml to set Draw.io webapp to root
RUN mkdir -p $CATALINA_HOME/webapps/draw && \
unzip /tmp/draw.war -d $CATALINA_HOME/webapps/draw && \
rm -rf /tmp/draw.war /tmp/drawio && \
cd $CATALINA_HOME && \
xmlstarlet ed \
-P -S -L \
-i '/Server/Service/Engine/Host/Valve' -t 'elem' -n 'Context' \
-i '/Server/Service/Engine/Host/Context' -t 'attr' -n 'path' -v '/' \
-i '/Server/Service/Engine/Host/Context[@path="/"]' -t 'attr' -n 'docBase' -v 'draw' \
-s '/Server/Service/Engine/Host/Context[@path="/"]' -t 'elem' -n 'WatchedResource' -v 'WEB-INF/web.xml' \
conf/server.xml
# Copy docker-entrypoint
COPY docker-entrypoint.sh /
RUN chmod 755 /docker-entrypoint.sh
# Add a tomcat user
RUN groupadd -r ${RUN_GROUP} && useradd -g ${RUN_GROUP} -d ${CATALINA_HOME} -s /bin/bash ${RUN_USER} && \
chown -R ${RUN_USER}:${RUN_GROUP} ${CATALINA_HOME}
USER ${RUN_USER}
WORKDIR $CATALINA_HOME
EXPOSE 8080 8443
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["catalina.sh", "run"]
Now you can build the arm/v7
version with docker build --platform linux/arm/v7 -t welywely/drawio:latest --push .