diff --git a/plugins/00_dokku-standard/subcommands/build b/plugins/00_dokku-standard/subcommands/build index b9ddbce63..884a45ccb 100755 --- a/plugins/00_dokku-standard/subcommands/build +++ b/plugins/00_dokku-standard/subcommands/build @@ -47,6 +47,9 @@ dokku_build_cmd() { [[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache" local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE") + # strip --volume and -v args from DOCKER_ARGS + local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS") + # shellcheck disable=SC2086 docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE . diff --git a/plugins/storage/subcommands/mount b/plugins/storage/subcommands/mount index b82a550cb..b078fe4e6 100755 --- a/plugins/storage/subcommands/mount +++ b/plugins/storage/subcommands/mount @@ -7,7 +7,7 @@ source "$PLUGIN_CORE_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) + local passed_phases=(build 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" diff --git a/plugins/storage/subcommands/unmount b/plugins/storage/subcommands/unmount index d460386d5..2e371a423 100755 --- a/plugins/storage/subcommands/unmount +++ b/plugins/storage/subcommands/unmount @@ -7,7 +7,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" storage_unmount_cmd() { declare desc="Remove bind-mount, restart app if running" local cmd="storage:unmount" - local passed_phases=(deploy run) + local passed_phases=(build deploy run) [[ -z $3 || $4 ]] && dokku_log_fail "storage:unmount requires an app and a two paths divided by colon." verify_app_name "$2" && local APP="$2" verify_paths "$3" && local MOUNT_PATH="$3" diff --git a/tests/unit/20_storage.bats b/tests/unit/20_storage.bats index a2b0059c7..6eb229fad 100644 --- a/tests/unit/20_storage.bats +++ b/tests/unit/20_storage.bats @@ -38,3 +38,18 @@ teardown() { assert_output "Mount path does not exist." assert_failure } + +@test "(storage) storage:mount (dockerfile)" { + run /bin/bash -c "dokku storage:mount $TEST_APP /tmp/mount:/mount" + echo "output: "$output + echo "status: "$status + assert_success + + deploy_app dockerfile + + CID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run /bin/bash -c "docker inspect -f '{{ .HostConfig.Binds }}' $CID" + echo "output: "$output + echo "status: "$status + assert_output "[/tmp/mount:/mount]" +}