-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·38 lines (32 loc) · 1.44 KB
/
entrypoint.sh
File metadata and controls
executable file
·38 lines (32 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# Standard-Shebang für POSIX-kompatible Shells.
# /bin/sh ist bewusst gewählt, weil es in minimalen Container-Images garantiert vorhanden ist.
set -e
# Beendet das Skript sofort, wenn ein Befehl einen Fehler zurückgibt.
# Erlaubt das Hinzufügen von Optionen über eine Umgebungsvariable,
# ohne den Entrypoint im Image ändern zu müssen.
: "${JAVA_OPTS:=}"
# Wir nutzen exec, damit Java die PID 1 übernimmt.
# Dies ist wichtig für das Signal-Handling (z.B. in Kubernetes).
# exec ersetzt den aktuellen Shell-Prozess durch den Java-Prozess.
# JVM-Optionen:
# -Djava.security.egd: Beschleunigt kryptografische Initialisierung
# -XX:MaxRAMPercentage=50: Java nutzt max 50% des Container-RAMs
# -XX:InitialRAMPercentage=30: Startet mit 30% RAM (schnellerer Startup)
# -XX:+UseG1GC: G1 Garbage Collector für niedrige Latenz
# -XX:MaxGCPauseMillis=200: Zielwert für GC-Pause
# -XX:+ExplicitGCInvokesConcurrent: System.gc() läuft parallel
# -XX:+ExitOnOutOfMemoryError: JVM beendet bei OOM (Kubernetes kann neustarten)
exec java \
$JAVA_OPTS \
-XX:SharedArchiveFile=/app/app.jsa \
-Djava.security.egd=file:/dev/./urandom \
-Dspring.aot.enabled=true \
-XX:MaxRAMPercentage=50 \
-XX:InitialRAMPercentage=30 \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 \
-XX:+ExplicitGCInvokesConcurrent \
-XX:+ExitOnOutOfMemoryError \
org.springframework.boot.loader.launch.JarLauncher \
--spring.config.location=file:/app/config/application.properties