Dockerfile 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. FROM tomcat:9-jre11-slim
  2. LABEL maintainer="Florian JUDITH <florian.judith.b@gmail.com>"
  3. ARG VERSION=11.3.0
  4. RUN apt-get update -y && \
  5. apt-get install -y --no-install-recommends \
  6. openjdk-11-jdk-headless ant git patch wget xmlstarlet certbot curl && \
  7. curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
  8. apt-get install -y --no-install-recommends nodejs chromium libatk-bridge2.0-0 libgtk-3-0 && \
  9. cd /tmp && \
  10. wget https://github.com/jgraph/draw.io/archive/v${VERSION}.zip && \
  11. unzip v${VERSION}.zip && \
  12. cd /tmp/drawio-${VERSION} && \
  13. cd /tmp/drawio-${VERSION}/etc/build && \
  14. ant war && \
  15. cd /tmp/drawio-${VERSION}/build && \
  16. unzip /tmp/drawio-${VERSION}/build/draw.war -d $CATALINA_HOME/webapps/draw && \
  17. mkdir /usr/local/drawio && \
  18. cd /usr/local/drawio && \
  19. git clone https://github.com/jgraph/draw-image-export2.git && \
  20. cd draw-image-export2 && \
  21. npm install && \
  22. apt-get remove -y --purge openjdk-11-jdk-headless ant git patch wget && \
  23. apt-get autoremove -y --purge && \
  24. apt-get remove -y --purge chromium && \
  25. apt-get clean && \
  26. rm -r /var/lib/apt/lists/* && \
  27. rm -rf \
  28. /tmp/v${VERSION}.zip \
  29. /tmp/drawio-${VERSION}
  30. COPY PreConfig.js PostConfig.js $CATALINA_HOME/webapps/draw/js/
  31. # Update server.xml to set Draw.io webapp to root
  32. RUN cd $CATALINA_HOME && \
  33. xmlstarlet ed \
  34. -P -S -L \
  35. -i '/Server/Service/Engine/Host/Valve' -t 'elem' -n 'Context' \
  36. -i '/Server/Service/Engine/Host/Context' -t 'attr' -n 'path' -v '/' \
  37. -i '/Server/Service/Engine/Host/Context[@path="/"]' -t 'attr' -n 'docBase' -v 'draw' \
  38. -s '/Server/Service/Engine/Host/Context[@path="/"]' -t 'elem' -n 'WatchedResource' -v 'WEB-INF/web.xml' \
  39. -i '/Server/Service/Engine/Host/Valve' -t 'elem' -n 'Context' \
  40. -i '/Server/Service/Engine/Host/Context[not(@path="/")]' -t 'attr' -n 'path' -v '/ROOT' \
  41. -s '/Server/Service/Engine/Host/Context[@path="/ROOT"]' -t 'attr' -n 'docBase' -v 'ROOT' \
  42. -s '/Server/Service/Engine/Host/Context[@path="/ROOT"]' -t 'elem' -n 'WatchedResource' -v 'WEB-INF/web.xml' \
  43. conf/server.xml
  44. # Copy docker-entrypoint
  45. COPY docker-entrypoint.sh /
  46. RUN chmod +x /docker-entrypoint.sh
  47. WORKDIR $CATALINA_HOME
  48. #If export server is not used outside draw.io, no need to expose port 8000
  49. EXPOSE 8080 8443 8000
  50. ENTRYPOINT ["/docker-entrypoint.sh"]
  51. CMD ["catalina.sh", "run"]