fix: do not write VHOST file if the DOKKU_ROOT directory does not exist

This can happen when building a new docker image as the DOKKU_ROOT directory isn't mounted yet.
This commit is contained in:
Jose Diaz-Gonzalez
2025-03-08 21:10:23 -05:00
parent 07bcc67597
commit 6007a95683

View File

@@ -2,8 +2,10 @@
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(hostname -f)") ]] && hostname -f >"$DOKKU_ROOT/VHOST"
if [[ ! -f "$DOKKU_ROOT/VHOST" ]] && [[ -n "$(dig +short "$(hostname -f)")" ]]; then
if [[ -d "$DOKKU_ROOT" ]] || [[ -L "$DOKKU_ROOT" ]]; then
hostname -f >"$DOKKU_ROOT/VHOST"
fi
fi
dokku_path="$(command -v dokku)"