#!/usr/bin/env bash source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/builder-nixpacks/internal-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 eval "$(config_export app "$APP" --merged)" plugn trigger pre-build-nixpacks "$APP" "$SOURCECODE_WORK_DIR" local flag_map=$(fn-plugin-property-get-all "builder-nixpacks" "$APP") let NIXPACKS_ARGS="" for flag in ${flag_map[@]} ; do NIXPACKS_ARGS+="$(echo "${flag}" | tr ' ' '=') " done echo /usr/bin/env "${NIXPACKS_ARGS}" nixpacks build . --name "$IMAGE" /usr/bin/env "${NIXPACKS_ARGS}" nixpacks build . --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 "$@"