File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 3939 echo 'RUN chmod +x /install.sh' >> Dockerfile
4040 echo 'RUN export DEBIAN_FRONTEND=noninteractive' >> Dockerfile
4141
42- # 安装 sudo 等基础工具
42+ # 安装 sudo 等基础工具(必须在 root 下做!)
4343 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
4444 echo 'RUN (command -v dnf >/dev/null && dnf install -y sudo git curl wget make gcc pkgconfig shadow-utils || true)' >> Dockerfile
4545 echo 'RUN (command -v yum >/dev/null && yum install -y sudo git curl wget make gcc pkgconfig shadow-utils || true)' >> Dockerfile
5858 SAFE_TAG=$(echo "${{ matrix.distro }}" | tr ':/' '-')
5959 docker build -t installsh-test:$SAFE_TAG .
6060
61- - name : Run install.sh in container (with sudo/fd fix)
61+ - name : Run install.sh in container
6262 run : |
6363 SAFE_TAG=$(echo "${{ matrix.distro }}" | tr ':/' '-')
64- docker run --rm installsh-test:$SAFE_TAG sh -c '
65- # ==== sudo 兼容: 没 sudo 就 alias sudo="" ====
66- if ! command -v sudo >/dev/null 2>&1; then alias sudo=""; fi
67- # ==== fd软链兼容: 保证 .local/bin 存在 ====
68- mkdir -p "$HOME/.local/bin"
69- # ==== 执行脚本 ====
70- sh /install.sh
71- '
64+ docker run --rm installsh-test:$SAFE_TAG sh -c "cd /home/testuser && sh /install.sh"
You can’t perform that action at this time.
0 commit comments