Jetty vs Tomcat – quel conteneur choisir pour PlantUML dans Docker ?

Comparaison des deux conteneurs servlet les plus courants, suivie de recommandations pour exposer PlantUML en tant que service HTTP dans un conteneur Docker.


1. Comparaison fonctionnelle

CritèreTomcatJetty
PhilosophieImplémentation Jakarta EE très complèteRuntime modulaire et embarquable
Taille du runtime~70 Mo~30-40 Mo
Mémoire par défaut~512 MB~256 MB
Hot reloadPossible via reloadable="true"Support natif via classloader
Servlet supportJakarta Servlet 5Jakarta Servlet 5
ClusteringSupport maturePossible mais moins documenté
JMXSupport intégréTrès simple à activer
Image Dockertomcat:10.1-jdk21 officielleJetty installé manuellement
PerformanceOptimisé pour fortes chargesTrès bon sur charges I/O
DocumentationTrès abondantePlus limitée

En résumé :

Tomcat est le choix le plus simple si l’on veut un runtime prêt à l’emploi avec un écosystème mature. Jetty est souvent préféré pour les micro-services ou les images Docker plus légères.


2. Pourquoi PlantUML a besoin d’un serveur web

PlantUML peut être utilisé de plusieurs manières.

ModeDescription
JAR standalonejava -jar plantuml.jar pour générer des diagrammes localement
Server modeAPI HTTP qui rend les diagrammes (/uml/...)
Servlet WARdéploiement dans Tomcat, Jetty ou autre conteneur servlet

Dans Docker, l’utilisation du WAR ou du mode serveur permet d’exposer PlantUML comme service HTTP.


3. Dockerfile PlantUML avec Tomcat


dockerfile
FROM tomcat:10.1-jdk21

ENV PLANTUML_VERSION=1.2024.6
ENV CATALINA_BASE=/usr/local/tomcat

RUN curl -L
[https://github.com/plantuml/plantuml-server/releases/download/v${PLANTUML_VERSION}/plantuml.war](https://github.com/plantuml/plantuml-server/releases/download/v${PLANTUML_VERSION}/plantuml.war)
-o ${CATALINA_BASE}/webapps/plantuml.war

EXPOSE 8080

CMD ["catalina.sh", "run"]

Points importants :

  • le fichier plantuml.war est placé dans webapps
  • Tomcat déploie automatiquement l’application
  • le service sera accessible via :

[http://localhost:8080/plantuml](http://localhost:8080/plantuml)

4. Dockerfile PlantUML avec Jetty


dockerfile
FROM eclipse-temurin:21-jre-alpine

ENV JETTY_VERSION=12.0.7
ENV JETTY_HOME=/opt/jetty
ENV PLANTUML_VERSION=1.2024.6

RUN mkdir -p $JETTY_HOME
&& curl -L [https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/${JETTY_VERSION}/jetty-home-${JETTY_VERSION}.tar.gz](https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/${JETTY_VERSION}/jetty-home-${JETTY_VERSION}.tar.gz)
| tar xz --strip-components=1 -C $JETTY_HOME

RUN mkdir -p $JETTY_HOME/webapps
&& curl -L
[https://github.com/plantuml/plantuml-server/releases/download/v${PLANTUML_VERSION}/plantuml.war](https://github.com/plantuml/plantuml-server/releases/download/v${PLANTUML_VERSION}/plantuml.war)
-o $JETTY_HOME/webapps/plantuml.war

EXPOSE 8080

CMD ["sh","-c","$JETTY_HOME/bin/jetty.sh run"]

Points importants :

  • Jetty est installé dans /opt/jetty
  • le WAR est placé dans webapps
  • l’image Alpine garde une taille minimale

5. Diagramme PlantUML comparatif


plantuml
@startuml
title Comparison Jetty vs Tomcat for PlantUML

actor Developer
actor CI
actor Ops

node "Tomcat" {
component "Tomcat 10.1"
}

node "Jetty" {
component "Jetty 12"
}

Developer --> Tomcat : deploy WAR
Developer --> Jetty : deploy WAR

CI --> Tomcat : health check
CI --> Jetty : health check

Ops --> Tomcat : monitoring
Ops --> Jetty : monitoring

@enduml

6. Recommandations

SituationServeur recommandéRaison
Application interne classiqueTomcatDocumentation et stabilité
Micro-service légerJettyRuntime plus compact
CI/CD avec ressources limitéesJettyImage plus petite
Environnement Tomcat existantTomcatRéutilisation de l’infrastructure

7. Checklist de déploiement

  1. Choisir l’image de base tomcat:10.1-jdk21 ou eclipse-temurin:21-jre-alpine

  2. Télécharger plantuml.war

  3. Exposer le port


EXPOSE 8080
  1. Ajouter un healthcheck

healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/plantuml"]
interval: 30s
timeout: 5s
retries: 3
  1. Ajouter éventuellement TLS via reverse proxy (Nginx, Traefik).

Conclusion

Tomcat fournit un environnement complet et largement documenté. Jetty propose un runtime plus léger et plus modulaire.

Le choix dépend principalement :

  • de la taille d’image souhaitée
  • de la complexité de l’infrastructure
  • de la charge attendue.