-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·34 lines (29 loc) · 859 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·34 lines (29 loc) · 859 Bytes
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
#!/bin/sh
set -e
# Generic entrypoint: detect and run the appropriate artifact
# Priority: /app/app.jar -> any executable in /jre/bin -> /app/app (native) -> first jar in /app or /app/target
# Usage: entrypoint.sh [app-args]
if [ -f /app/app.jar ]; then
exec java ${JAVA_OPTS} -jar /app/app.jar "$@"
fi
# If jlink produced a custom runtime, the launcher name varies.
# Look for the first executable file under /jre/bin and run it.
if [ -d /jre/bin ]; then
for f in /jre/bin/*; do
if [ -x "$f" ] && [ ! -d "$f" ]; then
exec "$f" "$@"
fi
done
fi
if [ -x /app/app ]; then
exec /app/app "$@"
fi
jar=$(ls /app/*.jar 2>/dev/null | head -n 1)
if [ -z "$jar" ]; then
jar=$(ls /app/target/*.jar 2>/dev/null | head -n 1)
fi
if [ -n "$jar" ]; then
exec java ${JAVA_OPTS} -jar "$jar" "$@"
fi
echo "No runnable artifact found in /app or /jre" >&2
exit 1