Skip to content

Commit 786bbea

Browse files
allow for special entrypoint apart from /opt/entry/
1 parent ff38b77 commit 786bbea

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

init-plain/usr/local/bin/entrypoint.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22
QUIET=${QUIET_ENTRYPOINT:-false}
3-
ENTRYPOINTS_DIR=${ENTRYPOINTS_DIR:-/opt/entry/}
43

54
function qecho() {
65
if [[ "X${QUIET}" != "Xtrue" ]];then
@@ -11,16 +10,29 @@ qecho "[II] qnib/init-plain script v0.4.25"
1110
set -e
1211

1312
if [[ -z ${SKIP_ENTRYPOINTS} ]];then
13+
## /opt/entry/
14+
for x in $(find /opt/entry/ -type f -perm /u+x |sort);do
15+
qecho "> execute entrypoint '${x}'"
16+
if [[ "$x" == *.env ]];then
17+
source ${x}
18+
else
19+
${x}
20+
fi
21+
done
1422
for x in $(find ${ENTRYPOINTS_DIR} -type f -perm /u+x |sort);do
1523
qecho "> execute entrypoint '${x}'"
1624
if [[ "$x" == *.env ]];then
1725
source ${x}
1826
else
1927
${x}
2028
fi
21-
done
29+
done
2230
fi
2331

32+
if [[ "${WAIT_TASK_SLOT}" != "X" ]] && $(echo "${WAIT_TASK_SLOT}" |sed -e 's/,/ /g' | grep -q -w "${SWARM_TASK_SLOT}");then
33+
qecho "> Slot ${SWARM_TASK_SLOT} in '${WAIT_TASK_SLOT}', so we wait.sh"
34+
exec wait.sh
35+
fi
2436
if [ "X${ENTRY_USER}" != "X" ];then
2537
qecho "> execute CMD as user '${ENTRY_USER}'"
2638
exec gosu ${ENTRY_USER} /bin/bash -c "$@"

0 commit comments

Comments
 (0)