Skip to content

Commit

Permalink
handle TTY sessions for better debuggability (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrock-thmdo authored Sep 5, 2023
1 parent de63564 commit 01f9715
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ if [ "${#}" -eq 0 ]; then
exit 1
fi

if tty --silent; then
# the user is likely trying to run an interactive shell in the container. example commands that
# might get us here:
#
# * docker compose run my-service /bin/bash
# * docker run --rm -it my-image /bin/bash
# * heroku run --app my-app -- /bin/bash
#
# we don't want to wait for the upstream app to start, etc. just execute the command (ex:
# `/bin/bash` above) and exit.
"${@}"
exit ${?}
fi

APP_PORT="${APP_PORT:-2000}"

if [ "${APP_PORT}" -eq "${PORT}" ]; then
Expand Down

0 comments on commit 01f9715

Please sign in to comment.