修复非 root debian dockerfile

This commit is contained in:
whyour
2026-05-30 23:55:57 +08:00
parent 84d730d510
commit abad29cbf9
15 changed files with 97 additions and 1046 deletions
+10 -4
View File
@@ -41,10 +41,16 @@ if [[ $command != "reload" ]]; then
os_name=$(source /etc/os-release && echo "$ID")
fi
# 非 root 用户使用 sudo
SUDO=""
if [ "$(id -u)" -ne 0 ]; then
SUDO="sudo"
fi
case "$os_name" in
alpine)
apk update
apk add -f bash \
$SUDO apk update
$SUDO apk add -f bash \
coreutils \
git \
curl \
@@ -59,8 +65,8 @@ if [[ $command != "reload" ]]; then
netcat-openbsd
;;
debian|ubuntu)
apt-get update
apt-get install -y git curl wget tzdata perl openssl jq nginx procps netcat-openbsd openssh-client
$SUDO apt-get update
$SUDO apt-get install -y git curl wget tzdata perl openssl jq nginx procps netcat-openbsd openssh-client
;;
*)
echo -e "暂不支持此系统部署 $os_name"