first script
parent
72a6e0ab35
commit
041aaac2b3
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
trigger-builder-nixpacks-builder-build() {
|
||||
declare desc="builder-nixpacks builder-build plugin trigger"
|
||||
declare trigger="builder-build"
|
||||
declare BUILDER_TYPE="$1" APP="$2" SOURCECODE_WORK_DIR="$3"
|
||||
|
||||
if [[ "$BUILDER_TYPE" != "nixpacks" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Building $APP with nixpacks"
|
||||
|
||||
if ! command -v "nixpacks" &>/dev/null; then
|
||||
dokku_log_fail "Missing nixpacks, install it"
|
||||
fi
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP")
|
||||
|
||||
pushd "$SOURCECODE_WORK_DIR" &>/dev/null
|
||||
|
||||
ENV_ARGS=($(config_export app "$APP" --format nixpacks-keys --merged))
|
||||
eval "$(config_export app "$APP" --merged)"
|
||||
|
||||
plugn trigger pre-build-nixpacks "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
if ! cd "$SOURCECODE_WORK_DIR" > /dev/null 2>&1; then
|
||||
dokku_log_fail "Could not change to '$SOURCECODE_WORK_DIR'"
|
||||
fi
|
||||
|
||||
nixpacks build "$IMAGE" \
|
||||
--env "${ENV_ARGS[@]}" \
|
||||
--name "$IMAGE"
|
||||
docker-image-labeler --label=dokku --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.image-stage=build --label=com.dokku.builder-type=pack --label=com.dokku.app-name=$APP "$IMAGE"
|
||||
|
||||
plugn trigger post-build-nixpacks "$APP" "$SOURCECODE_WORK_DIR"
|
||||
}
|
||||
|
||||
trigger-builder-nixpacks-builder-build "$@"
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
trigger-builder-nixpacks-builder-detect() {
|
||||
declare desc="builder-nixpacks builder-detect plugin trigger"
|
||||
declare trigger="builder-detect"
|
||||
declare APP="$1" SOURCECODE_WORK_DIR="$2"
|
||||
|
||||
echo "nixpacks"
|
||||
return
|
||||
}
|
||||
|
||||
trigger-builder-pack-builder-detect "$@"
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-builder-nixpacks-builder-release() {
|
||||
declare desc="builder-nixpacks builder-release plugin trigger"
|
||||
declare trigger="builder-release"
|
||||
declare BUILDER_TYPE="$1" APP="$2" IMAGE_TAG="$3"
|
||||
|
||||
if [[ "$BUILDER_TYPE" != "nixpacks" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
plugn trigger pre-release-nixpacks "$APP" "$IMAGE_TAG"
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
docker-image-labeler --label=com.dokku.image-stage=release --label=com.dokku.app-name=$APP --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku "$IMAGE"
|
||||
plugn trigger post-release-nixpacks "$APP" "$IMAGE_TAG"
|
||||
plugn trigger post-release-builder "$BUILDER_TYPE" "$APP" "$IMAGE"
|
||||
}
|
||||
|
||||
trigger-builder-nixpacks-builder-release "$@"
|
|
@ -0,0 +1,4 @@
|
|||
[plugin]
|
||||
description = "dokku community builder-nixpacks plugin"
|
||||
version = "1.0.0"
|
||||
[plugin.config]
|
Loading…
Reference in New Issue