Skip to content

Commit 477a433

Browse files
committed
fix: run as root (Basilica blocks sudo), remove sudo prefix logic
1 parent 1aceb88 commit 477a433

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@ RUN cargo build --release && strip target/release/term-executor
1111
# ── Runtime stage ──
1212
FROM debian:bookworm-slim
1313
RUN apt-get update && apt-get install -y --no-install-recommends \
14-
ca-certificates git curl libssl3 sudo \
14+
ca-certificates git curl libssl3 \
1515
python3 python3-pip python3-venv \
1616
build-essential nodejs npm \
1717
golang-go \
1818
&& ln -sf /usr/bin/python3 /usr/bin/python \
1919
&& corepack enable 2>/dev/null || true \
2020
&& rm -rf /var/lib/apt/lists/*
2121
COPY --from=builder /build/target/release/term-executor /usr/local/bin/
22-
RUN groupadd --system executor && useradd --system --gid executor --create-home executor \
23-
&& echo "executor ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/executor \
24-
&& mkdir -p /tmp/sessions && chown executor:executor /tmp/sessions
25-
USER executor
22+
RUN mkdir -p /tmp/sessions
2623
ENV IMAGE_NAME=platformnetwork/term-executor
2724
ENV IMAGE_DIGEST=""
2825
EXPOSE 8080

src/executor.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,22 +331,9 @@ 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-
// 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);
334+
info!("[{}] Installing: {}", task.id, cmd);
348335
let (_, stderr, exit) = run_shell(
349-
&effective_cmd,
336+
cmd,
350337
&repo_dir,
351338
Duration::from_secs(config.clone_timeout_secs),
352339
None,

0 commit comments

Comments
 (0)