fix(deploy): update.sh 的 APP_DIR 从脚本位置推导,不写死 /opt/zcbot
部署目录 = 脚本所在 deploy/ 的上一级,用 readlink -f 解析(兼容相对路径 / 软链调用),仍可 APP_DIR env 覆盖。换部署路径不必再改脚本字面量。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e62d4fce4a
commit
e8aeef19de
|
|
@ -15,7 +15,7 @@
|
|||
# 一次性 bootstrap(useradd / 写 systemd unit / enable)不在这里 —— 见 RUN.md §部署 一次性。
|
||||
#
|
||||
# 可调 env(不传则用默认 / Dockerfile 默认):
|
||||
# APP_DIR(/opt/zcbot) APP_USER(zcbot) SERVICE(zcbot) PORT(8765)
|
||||
# APP_DIR(默认=脚本上级目录,即仓库根) APP_USER(zcbot) SERVICE(zcbot) PORT(8765)
|
||||
# APT_MIRROR / PIP_INDEX_URL / PIP_TRUSTED_HOST / NPM_REGISTRY 镜像源,
|
||||
# 默认阿里源(境内快);要稳定命中 docker cache 就别在两组源之间来回换
|
||||
# (换源会从 pip 层炸开全重跑)。想用官方源:PIP_INDEX_URL= sudo -E bash ...(置空)
|
||||
|
|
@ -23,7 +23,11 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
APP_DIR="${APP_DIR:-/opt/zcbot}"
|
||||
# 部署目录 = 本脚本所在目录(deploy/)的上一级,不写死路径;仍可 env 覆盖。
|
||||
# readlink -f 解析软链 + 相对路径,兼容 `sudo ./update.sh` / `sudo bash /abs/deploy/update.sh`
|
||||
# / 经软链调用(Ubuntu coreutils 有 readlink -f)。
|
||||
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
APP_DIR="${APP_DIR:-$(dirname "$SCRIPT_DIR")}"
|
||||
APP_USER="${APP_USER:-zcbot}"
|
||||
SERVICE="${SERVICE:-zcbot}"
|
||||
PORT="${PORT:-8765}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue