Merge pull request #3092 from dokku/configurable-shell

Add support for configuring the app shell
This commit is contained in:
Jose Diaz-Gonzalez authored and GitHub committed 2018-03-03 22:48:13 -05:00
commit 7917072941
3 files changed
+13 -2

No files matched your search

@@ -92,6 +92,7 @@ The following list config variables have special meaning and can be set in a var
| `DOKKU_TRACE` | none | `dokku trace on` <br /> `dokku trace false` <br /> `--trace` flag | Turn on very verbose debugging. | | `DOKKU_TRACE` | none | `dokku trace on` <br /> `dokku trace false` <br /> `--trace` flag | Turn on very verbose debugging. |
| `DOKKU_APP_PROXY_TYPE` | `nginx` | `dokku proxy:set` | | | `DOKKU_APP_PROXY_TYPE` | `nginx` | `dokku proxy:set` | |
| `DOKKU_APP_RESTORE` | `1` | `dokku config:set` <br /> `dokku ps:stop` | | | `DOKKU_APP_RESTORE` | `1` | `dokku config:set` <br /> `dokku ps:stop` | |
| `DOKKU_APP_SHELL` | `/bin/bash` | `dokku config:set` | Allows users to change the default shell used by Dokku for `dokku enter` and execution of deployment tasks. |
| `DOKKU_APP_TYPE` | `herokuish` | Auto-detected by using buildpacks or dockerfile | | | `DOKKU_APP_TYPE` | `herokuish` | Auto-detected by using buildpacks or dockerfile | |
| `DOKKU_CHECKS_DISABLED` | none | `dokku checks:disable` | | | `DOKKU_CHECKS_DISABLED` | none | `dokku checks:disable` | |
| `DOKKU_CHECKS_ENABLED` | none | `dokku checks:enable` | | | `DOKKU_CHECKS_ENABLED` | none | `dokku checks:enable` | |
@@ -61,7 +61,12 @@ execute_script() {
declare -a ARG_ARRAY declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)" eval "ARG_ARRAY=($DOCKER_ARGS)"
id=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" /bin/bash -c "$COMMAND") local DOKKU_APP_SHELL="/bin/bash"
DOKKU_APP_SHELL="$(config_get --global DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"
DOKKU_APP_SHELL="$(config_get "$APP" DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"
[[ -z "$DOKKU_APP_SHELL" ]] && DOKKU_APP_SHELL="/bin/bash"
id=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" "$DOKKU_APP_SHELL" -c "$COMMAND")
if test "$(docker wait "$id")" -eq 0; then if test "$(docker wait "$id")" -eq 0; then
dokku_container_log_verbose_quiet "$id" dokku_container_log_verbose_quiet "$id"
if [[ "$PHASE_SCRIPT_KEY" != "postdeploy" ]];then if [[ "$PHASE_SCRIPT_KEY" != "postdeploy" ]];then
+6 -1
View File
@@ -47,11 +47,16 @@ enter_default_cmd() {
docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist" docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist"
docker inspect -f '{{ .State.Running }}' "$ID" | grep -q "true" > /dev/null || dokku_log_fail "Container is not running" docker inspect -f '{{ .State.Running }}' "$ID" | grep -q "true" > /dev/null || dokku_log_fail "Container is not running"
local DOKKU_APP_SHELL="/bin/bash"
DOKKU_APP_SHELL="$(config_get --global DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"
DOKKU_APP_SHELL="$(config_get "$APP" DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"
[[ -z "$DOKKU_APP_SHELL" ]] && DOKKU_APP_SHELL="/bin/bash"
local EXEC_CMD="" local EXEC_CMD=""
has_tty && local DOKKU_RUN_OPTS+=" -i -t" has_tty && local DOKKU_RUN_OPTS+=" -i -t"
is_image_herokuish_based "$IMAGE" && local EXEC_CMD="/exec" is_image_herokuish_based "$IMAGE" && local EXEC_CMD="/exec"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
docker exec $DOKKU_RUN_OPTS $ID $EXEC_CMD "${@:-/bin/bash}" docker exec $DOKKU_RUN_OPTS $ID $EXEC_CMD "${@:-$DOKKU_APP_SHELL}"
} }
enter_default_cmd "$@" enter_default_cmd "$@"