diff --git a/Dockerfile b/Dockerfile index 4bb4446..7e002e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,5 +37,6 @@ COPY --from=build-image /build/target/sudoc.jar /app/sudoc.jar ENV TZ=Europe/Paris RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone COPY ./docker/docker-entrypoint.sh /docker-entrypoint.sh +COPY ./docker/jstatd.all.policy /app/jstatd.all.policy RUN chmod +x /docker-entrypoint.sh ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 2367abf..7d4fe2b 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -1,4 +1,15 @@ #!/bin/bash export HOSTNAME=${HOSTNAME} -java -XX:MaxRAMPercentage=75 -XX:+UseG1GC -XX:ConcGCThreads=5 -XX:+ExitOnOutOfMemoryError -XX:MaxGCPauseMillis=100 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=${HOSTNAME} -jar /app/sudoc.jar \ No newline at end of file + +echo "Démarrage de jstatd..." +jstatd -J-Djava.security.policy=/app/jstatd.all.policy -p 1099 & +JSTATD_PID=$! + +echo "Démarrage de l'application Java..." +java -XX:MaxRAMPercentage=75 -XX:+UseG1GC -XX:ConcGCThreads=5 -XX:+ExitOnOutOfMemoryError -XX:MaxGCPauseMillis=100 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=${HOSTNAME} -jar /app/sudoc.jar +JAVA_APP_PID=$! + +# Attendre que les processus se terminent +wait $JAVA_APP_PID +kill $JSTATD_PID \ No newline at end of file diff --git a/docker/jstatd.all.policy b/docker/jstatd.all.policy new file mode 100644 index 0000000..3cb2ba1 --- /dev/null +++ b/docker/jstatd.all.policy @@ -0,0 +1,3 @@ +grant codebase "file:${java.home}/../lib/tools.jar" { + permission java.security.AllPermission; +}; \ No newline at end of file