Files
dokku/plugins/storage/subcommands/mount
2017-03-15 02:42:10 -06:00

19 lines
779 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/storage/functions"
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
storage_mount_cmd() {
declare desc="Add bind-mount, redeploy app if running"
local cmd="storage:mount"
local passed_phases=(deploy run)
[[ -z $3 || $4 ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon."
verify_app_name "$2" && local APP="$2"
verify_paths "$3" && local MOUNT_PATH="$3"
check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" && dokku_log_fail "Mount path already exists."
add_passed_docker_option passed_phases[@] "-v $MOUNT_PATH"
}
storage_mount_cmd "$@"