feat: implement container network attaching
Containers can be attached: - after they are created, but before they are started - after a successful deploy, but before the proxy reloads This allows folks to have flexibility around when they would like a container to be made available to a network.
This commit is contained in:
@@ -98,8 +98,13 @@ execute_script() {
|
||||
DOKKU_APP_SHELL="$(config_get "$APP" DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"
|
||||
[[ -z "$DOKKU_APP_SHELL" ]] && DOKKU_APP_SHELL="/bin/bash"
|
||||
|
||||
id=$("$DOCKER_BIN" container run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --env DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_HOST_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" "$DOKKU_APP_SHELL" -c "$COMMAND")
|
||||
if test "$("$DOCKER_BIN" container wait "$id")" -ne 0; then
|
||||
local DOKKU_CONTAINER_EXIT_CODE=0
|
||||
id=$("$DOCKER_BIN" container create "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --env DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -v "$CACHE_HOST_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" "$DOKKU_APP_SHELL" -c "$COMMAND")
|
||||
plugn trigger post-container-create "app" "$id" "$APP" "$PHASE_SCRIPT_KEY"
|
||||
"$DOCKER_BIN" container start "$id" >/dev/null || DOKKU_CONTAINER_EXIT_CODE=$?
|
||||
DOKKU_CONTAINER_EXIT_CODE="$("$DOCKER_BIN" container wait "$id" 2>/dev/null || echo "$DOKKU_CONTAINER_EXIT_CODE")"
|
||||
|
||||
if [[ "$DOKKU_CONTAINER_EXIT_CODE" -ne 0 ]]; then
|
||||
dokku_container_log_verbose_quiet "$id"
|
||||
dokku_log_fail "execution of '$SCRIPT_CMD' failed!"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user