Files
dokku/plugins/nginx-vhosts/core-post-extract
Jose Diaz-Gonzalez 17814d4847 refactor: only extract the nginx.conf.sigil from the source code and not an app path
The previous method was a bit more difficult for users to interact with as they needed to ensure the file was at a certain path in the built image. This change divorces the file from the built artifact, better aligning the nginx.conf.sigil handling with the rest of Dokku's monorepo support.

A side effect of this is now building proxy configurations does not require access to the built image.

Closes #5207
2022-11-23 19:32:53 -05:00

29 lines
846 B
Bash
Executable File

#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
trigger-nginx-vhosts-core-post-extract() {
declare desc="nginx-vhosts post-extract plugin trigger"
declare trigger="post-extract"
declare APP="$1" SOURCECODE_WORK_DIR="$2"
local CONF_SIGIL_PATH="$(fn-nginx-computed-nginx-conf-sigil-path "$APP")"
pushd "$TMP_WORK_DIR" >/dev/null
if [[ -z "$CONF_SIGIL_PATH" ]]; then
return
fi
if [[ ! -f "$CONF_SIGIL_PATH" ]]; then
return
fi
rm -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/upcoming.nginx.conf.sigil"
cp -f "$CONF_SIGIL_PATH" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/upcoming.nginx.conf.sigil"
popd &>/dev/null || pushd "/tmp" >/dev/null
}
trigger-nginx-vhosts-core-post-extract "$@"