Skip to content

Commit

Permalink
fix resolving relative path commands in runtime image
Browse files Browse the repository at this point in the history
  • Loading branch information
mikz committed Oct 23, 2017
1 parent 48300e2 commit f83f6c2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bin/container-entrypoint
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
#!/bin/bash
exec "$@"
set -euo pipefail
IFS=$'\n\t'

# s2i sets the default command to scripts/run.
# Changing a directory would break that relative path.
# So lets resolve it before changing the directory and use the absolute path.

args=("$@")
cmd="$(readlink -e "${args[0]}")"

args[0]="${cmd:-${args[0]}}"

cd "${HOME}" # change to home directory

exec "$args"

0 comments on commit f83f6c2

Please sign in to comment.