Skip to content

Commit 33ba3e5

Browse files
ltangvaldyosifkit
authored andcommitted
entrypoint: Only execute main function if the script is not sourced
If entrypoint.sh is sourced from elsewhere we don't execute the main function, so custom entrypoint scripts can use the helper functions directly.
1 parent db2319e commit 33ba3e5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.template.Debian/docker-entrypoint.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,8 @@ docker_main() {
322322
fi
323323
exec "$@"
324324
}
325-
326-
docker_main "$@"
325+
# This checks if the script has been sourced from elsewhere.
326+
# If so we don't perform any further actions
327+
if [ ! "${FUNCNAME[${#FUNCNAME[@]} - 1]}" = 'source' ]; then
328+
docker_main "$@"
329+
fi

0 commit comments

Comments
 (0)