-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
46 lines (34 loc) · 1.36 KB
/
entrypoint.sh
File metadata and controls
46 lines (34 loc) · 1.36 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
39
40
41
42
43
44
45
46
#!/bin/bash
# ---- BEGIN OF CONFIG SECTION ---- #
# Target
artifactName=`curl -s -X 'GET' -H 'accept: application/json' 'https://ci.loohpjames.com/job/Limbo/lastSuccessfulBuild/api/json' | jq -r '.artifacts[1].fileName'`
# Mandatory variables
downloadUrl="https://ci.loohpjames.com/job/Limbo/lastSuccessfulBuild/artifact/target/${artifactName}"
allocatedMemorySize="256M"
# Optional variables
additionalJvmArguments=""
additonalScriptPath=""
# ----- END OF CONFIG SECTION ----- #
##### !! DO NOT EDIT BELOW !! #####
echo 'Executing entrypoint...'
# Check necessary variables are defined
if [ -z ${downloadUrl} ]; then
echo 'You must write script as downloadUrl variable to download server jar file at config section in entrypoint.sh' >&2
exit 1
elif [ -z ${allocatedMemorySize} ]; then
echo 'You must specify allocated memory size for server as allocatedMemorySize variable at config section in entrypoint.sh' >&2
exit 1
fi
# Make sure we are in correct workdir
cd /server
# Download server jar artifact
echo 'Downloading server jar file...'
curl -fsSL -o /server/server.jar ${downloadUrl}
# Run additonal script if defined
if [ ! -z ${additonalScriptPath} ]; then
echo 'Executing additonal script...'
bash -c ${additionalScriptPath}
fi
# Run server
echo 'Booting server...'
java -Xmx${allocatedMemorySize} ${additionalJvmArguments} -jar server.jar nogui