-
Notifications
You must be signed in to change notification settings - Fork 19
/
docker-entrypoint.sh
executable file
·108 lines (94 loc) · 3.19 KB
/
docker-entrypoint.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
set -e
if [ "$1" = jetty.sh ]; then
if ! command -v bash >/dev/null 2>&1 ; then
cat >&2 <<- 'EOWARN'
********************************************************************
ERROR: bash not found. Use of jetty.sh requires bash.
********************************************************************
EOWARN
exit 1
fi
cat >&2 <<- 'EOWARN'
********************************************************************
WARNING: Use of jetty.sh from this image is deprecated and may
be removed at some point in the future.
See the documentation for guidance on extending this image:
https://github.com/docker-library/docs/tree/master/jetty
********************************************************************
EOWARN
fi
if ! command -v -- "$1" >/dev/null 2>&1 ; then
set -- java -jar "$JETTY_HOME/start.jar" "$@"
fi
: ${TMPDIR:=/tmp/jetty}
[ -d "$TMPDIR" ] || mkdir -p $TMPDIR 2>/dev/null
: ${JETTY_START:=$JETTY_BASE/jetty.start}
case "$JAVA_OPTIONS" in
*-Djava.io.tmpdir=*) ;;
*) JAVA_OPTIONS="-Djava.io.tmpdir=$TMPDIR $JAVA_OPTIONS" ;;
esac
if expr "$*" : 'java .*/start\.jar.*$' >/dev/null ; then
# this is a command to run jetty
# check if it is a terminating command
for A in "$@" ; do
case $A in
--add-to-start* |\
--create-files |\
--create-startd |\
--download |\
--dry-run |\
--exec-print |\
--help |\
--info |\
--list-all-modules |\
--list-classpath |\
--list-config |\
--list-modules* |\
--stop |\
--update-ini |\
--version |\
-v )\
# It is a terminating command, so exec directly
JAVA="$1"
shift
# The $START_OPTIONS is the JVM options for the JVM which will do the --dry-run.
# The $JAVA_OPTIONS contains the JVM options used in the output of the --dry-run command.
eval "exec $JAVA $START_OPTIONS \"\$@\" $JAVA_OPTIONS $JETTY_PROPERTIES"
esac
done
if [ $(whoami) != "jetty" ]; then
cat >&2 <<- EOWARN
********************************************************************
WARNING: User is $(whoami)
The user should be (re)set to 'jetty' in the Dockerfile
********************************************************************
EOWARN
fi
if [ -f $JETTY_START ] ; then
if [ $JETTY_BASE/start.d -nt $JETTY_START ] ; then
cat >&2 <<- EOWARN
********************************************************************
WARNING: The $JETTY_BASE/start.d directory has been modified since
the $JETTY_START files was generated.
To avoid regeneration delays at start, either delete
the $JETTY_START file or re-run /generate-jetty-start.sh
from a Dockerfile.
********************************************************************
EOWARN
/generate-jetty-start.sh "$@"
fi
echo $(date +'%Y-%m-%d %H:%M:%S.000'):INFO:docker-entrypoint:jetty start from $JETTY_START
else
/generate-jetty-start.sh "$@"
fi
## The generate-jetty-start script always starts the jetty.start file with exec, so this command will exec Jetty.
## We need to do this because the file may have quoted arguments which cannot be read into a variable.
. $JETTY_START
fi
if [ "${1##*/}" = java -a -n "$JAVA_OPTIONS" ] ; then
JAVA="$1"
shift
set -- "$JAVA" $JAVA_OPTIONS "$@"
fi
exec "$@"