File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,16 @@ RUN cargo build --release && strip target/release/term-executor
1111# ── Runtime stage ──
1212FROM debian:bookworm-slim
1313RUN apt-get update && apt-get install -y --no-install-recommends \
14- ca-certificates git curl libssl3 \
14+ ca-certificates git curl libssl3 sudo \
1515 python3 python3-pip python3-venv \
1616 build-essential nodejs npm \
17+ golang-go \
1718 && ln -sf /usr/bin/python3 /usr/bin/python \
19+ && corepack enable 2>/dev/null || true \
1820 && rm -rf /var/lib/apt/lists/*
1921COPY --from=builder /build/target/release/term-executor /usr/local/bin/
2022RUN groupadd --system executor && useradd --system --gid executor --create-home executor \
23+ && echo "executor ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/executor \
2124 && mkdir -p /tmp/sessions && chown executor:executor /tmp/sessions
2225USER executor
2326ENV IMAGE_NAME=platformnetwork/term-executor
Original file line number Diff line number Diff line change @@ -331,9 +331,22 @@ async fn run_task_pipeline(
331331 result. status = TaskStatus :: InstallingDeps ;
332332 if let Some ( ref install_cmds) = task. workspace . install {
333333 for cmd in install_cmds {
334- info ! ( "[{}] Installing: {}" , task. id, cmd) ;
334+ // Prefix commands that need root (apt-get, dpkg, etc.) with sudo
335+ let effective_cmd = if cmd. trim_start ( ) . starts_with ( "apt-get" )
336+ || cmd. trim_start ( ) . starts_with ( "dpkg" )
337+ || cmd. trim_start ( ) . starts_with ( "apt " )
338+ {
339+ format ! ( "sudo {}" , cmd)
340+ } else if cmd. contains ( "apt-get" ) || cmd. contains ( "dpkg" ) {
341+ // Command chain containing apt-get (e.g. "apt-get update && apt-get install ...")
342+ cmd. replace ( "apt-get" , "sudo apt-get" )
343+ . replace ( "dpkg" , "sudo dpkg" )
344+ } else {
345+ cmd. clone ( )
346+ } ;
347+ info ! ( "[{}] Installing: {}" , task. id, effective_cmd) ;
335348 let ( _, stderr, exit) = run_shell (
336- cmd ,
349+ & effective_cmd ,
337350 & repo_dir,
338351 Duration :: from_secs ( config. clone_timeout_secs ) ,
339352 None ,
You can’t perform that action at this time.
0 commit comments