Skip to content

Commit

Permalink
entrypoint: Only execute main function if the script is not sourced
Browse files Browse the repository at this point in the history
If entrypoint.sh is sourced from elsewhere we don't execute the main
function, so custom entrypoint scripts can use the helper functions
directly.
  • Loading branch information
ltangvald authored and yosifkit committed Sep 18, 2019
1 parent db2319e commit 33ba3e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .template.Debian/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -322,5 +322,8 @@ docker_main() {
fi
exec "$@"
}

docker_main "$@"
# This checks if the script has been sourced from elsewhere.
# If so we don't perform any further actions
if [ ! "${FUNCNAME[${#FUNCNAME[@]} - 1]}" = 'source' ]; then
docker_main "$@"
fi

0 comments on commit 33ba3e5

Please sign in to comment.