@@ -39,15 +39,15 @@ jobs:
3939 echo 'RUN chmod +x /install.sh' >> Dockerfile
4040 echo 'RUN export DEBIAN_FRONTEND=noninteractive' >> Dockerfile
4141
42- # 安装 sudo 等基础工具(必须在 root 下做!)
43- echo 'RUN (command -v apt-get >/dev/null && apt-get update && apt-get install -y sudo git curl wget make gcc pkg-config build-essential || true)' >> Dockerfile
44- echo 'RUN (command -v dnf >/dev/null && dnf install -y sudo git curl wget make gcc pkgconfig shadow-utils || true)' >> Dockerfile
45- echo 'RUN (command -v yum >/dev/null && yum install -y sudo git curl wget make gcc pkgconfig shadow-utils || true)' >> Dockerfile
46- echo 'RUN (command -v pacman >/dev/null && pacman -Sy --noconfirm sudo git curl wget make gcc pkgconf base-devel shadow || true)' >> Dockerfile
47- echo 'RUN (command -v zypper >/dev/null && zypper --non-interactive install sudo git curl wget make gcc pkgconf shadow || true)' >> Dockerfile
48- echo 'RUN (command -v apk >/dev/null && apk add --no-cache sudo git curl wget make gcc pkgconf build-base shadow || true)' >> Dockerfile
42+ # root下装sudo等基础依赖
43+ echo 'RUN (command -v apt-get >/dev/null && apt-get update && apt-get install -y sudo git curl wget make gcc pkg-config build-essential passwd || true)' >> Dockerfile
44+ echo 'RUN (command -v dnf >/dev/null && dnf install -y sudo git curl wget make gcc pkgconfig shadow-utils passwd || true)' >> Dockerfile
45+ echo 'RUN (command -v yum >/dev/null && yum install -y sudo git curl wget make gcc pkgconfig shadow-utils passwd || true)' >> Dockerfile
46+ echo 'RUN (command -v pacman >/dev/null && pacman -Sy --noconfirm sudo git curl wget make gcc pkgconf base-devel shadow passwd || true)' >> Dockerfile
47+ echo 'RUN (command -v zypper >/dev/null && zypper --non-interactive install sudo git curl wget make gcc pkgconf shadow passwd || true)' >> Dockerfile
48+ echo 'RUN (command -v apk >/dev/null && apk add --no-cache sudo git curl wget make gcc pkgconf build-base shadow passwd || true)' >> Dockerfile
4949
50- # 创建 testuser 并赋予 sudo 权限
50+ # 创建 testuser 用户并赋予 sudo 权限
5151 echo 'RUN useradd -m testuser || adduser -D testuser || true' >> Dockerfile
5252 echo 'RUN echo "testuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers' >> Dockerfile
5353 echo 'USER testuser' >> Dockerfile
5858 SAFE_TAG=$(echo "${{ matrix.distro }}" | tr ':/' '-')
5959 docker build -t installsh-test:$SAFE_TAG .
6060
61- - name : Run install.sh in container
61+ - name : Run install.sh in container (as testuser)
6262 run : |
6363 SAFE_TAG=$(echo "${{ matrix.distro }}" | tr ':/' '-')
6464 docker run --rm installsh-test:$SAFE_TAG sh -c "cd /home/testuser && sh /install.sh"
0 commit comments