-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-entrypoint.sh
33 lines (26 loc) · 973 Bytes
/
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
#!/bin/sh
# @author Michael Wiesendanger <[email protected]>
# @description launch script for nexus
set -euo pipefail
create_data_dir() {
echo "$(date) [INFO]: Creating data directory ${NEXUS_DATA_DIR} and setting permissions"
mkdir -p ${NEXUS_DATA_DIR}/etc ${NEXUS_DATA_DIR}/log ${NEXUS_DATA_DIR}/tmp
chown -R "${NEXUS_USER}":"${NEXUS_GROUP}" "${NEXUS_DATA_DIR}"
}
init() {
if [ -f "${NEXUS_DATA_DIR}/.init" ]; then
echo "$(date) [INFO]: Init script already run - starting Nexus"
# check if run directory exists
create_data_dir
echo "$(date) [INFO]: Starting nexus ..."
exec su-exec "${NEXUS_USER}" "${NEXUS_HOME}/bin/nexus" run
else
echo "$(date) [INFO]: First time setup - running init script"
create_data_dir
touch "${NEXUS_DATA_DIR}/.init"
echo "$(date) [INFO]: Init script done"
echo "$(date) [INFO]: Starting nexus ..."
exec su-exec "${NEXUS_USER}" "${NEXUS_HOME}/bin/nexus" run
fi
}
init