diff --git a/infra/bobshell/Containerfile b/infra/bobshell/Containerfile index 4c6367a..ae2f00c 100644 --- a/infra/bobshell/Containerfile +++ b/infra/bobshell/Containerfile @@ -5,13 +5,17 @@ # Based on ubi10/nodejs-24, which provides Node.js 24 (Bob Shell requires # Node.js >= 22.15). Bob Shell is installed with the official installer, the # IBM license is pre-accepted, and the /workspace directory is pre-trusted so -# the CLI runs non-interactively. +# the CLI runs non-interactively. acpbox (OpenAI-compatible HTTP gateway to +# the Agent Client Protocol, https://pypi.org/project/acpbox/) is installed +# from PyPI on UBI's Python 3.12. # # Build (from this directory): # docker build -f Containerfile -t bobshell . # # Pin a Bob Shell version: # docker build --build-arg BOB_VERSION=2.0.5 -t bobshell . +# Pin acpbox similarly: +# docker build --build-arg ACPBOX_VERSION=0.2.3 -t bobshell . # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ FROM registry.access.redhat.com/ubi10/nodejs-24-minimal:latest @@ -23,6 +27,46 @@ RUN mkdir -p /workspace \ && chown 1001:0 /workspace \ && chmod g=u /workspace COPY --chmod=0755 entrypoint.sh /usr/local/bin/bob-entrypoint + +# Install acpbox (https://pypi.org/project/acpbox/), the OpenAI-compatible +# HTTP gateway to the Agent Client Protocol. It needs Python >= 3.11, which +# UBI 10 provides as Python 3.12. Installed system-wide so `acpbox` is on +# PATH for the runtime user; pip itself is removed afterwards to keep the +# runtime image lean. Note acpbox has no --version/--help flags: any +# invocation boots the gateway, which expects an ACP agent command +# (ACPBOX_ACP_COMMAND or a config.yaml) at runtime. +ARG ACPBOX_VERSION="" +RUN set -eu; \ + microdnf install -y python3 python3-pip; \ + if [ -n "${ACPBOX_VERSION}" ]; then \ + pip3 install --no-cache-dir --root-user-action=ignore "acpbox==${ACPBOX_VERSION}"; \ + else \ + pip3 install --no-cache-dir --root-user-action=ignore acpbox; \ + fi; \ + microdnf remove -y python3-pip; \ + microdnf clean all; \ + command -v acpbox; \ + python3 -c "import acpbox.main" + +# Configure acpbox to drive Bob Shell: each gateway worker spawns one +# `bob acp` process (ACP over stdio) at startup, with sessions rooted at the +# pre-trusted /workspace (acpbox's default ./workspace would resolve to +# /workspace/workspace in this image). Both are overridable at runtime with +# `docker run -e`. (Single quotes: Docker's ENV parser strips inner double +# quotes, which would corrupt the JSON array acpbox expects.) +# --trust: `bob acp` rejects session/new for untrusted workspaces and does +# not consult ~/.bob/trustedFolders.json, so the flag is the only headless +# path. It trusts every workspace the ACP server opens, but acpbox always +# pins the session cwd to ACPBOX_ACP_WORKSPACE, so in practice only +# /workspace is trusted — matching this image's documented pre-trust scope. +ENV ACPBOX_ACP_COMMAND='["bob","acp","--trust"]' +ENV ACPBOX_ACP_WORKSPACE=/workspace + +# acpbox publishes its OpenAI-compatible API on TCP 8080 (binds 0.0.0.0; +# override with ACPBOX_GATEWAY_PORT). Bob Shell itself listens on no port. +# EXPOSE is documentation only — publish with `docker run -p 8080:8080`. +EXPOSE 8080 + USER 1001 # Install Bob Shell via the official installer. The installer verifies the diff --git a/infra/bobshell/README.md b/infra/bobshell/README.md index 5995a9b..e43cb5e 100644 --- a/infra/bobshell/README.md +++ b/infra/bobshell/README.md @@ -5,6 +5,16 @@ as a container image on `registry.access.redhat.com/ubi10/nodejs-24`. - Bob Shell installed via the [official installer](https://bob.ibm.com/docs/shell/getting-started/install-and-setup) (SHA256-verified, `npm install -g`). +- [acpbox](https://pypi.org/project/acpbox/) — the OpenAI-compatible HTTP + gateway to the Agent Client Protocol — installed from PyPI on Python 3.12 + and preconfigured via `ACPBOX_ACP_COMMAND=["bob","acp","--trust"]` to spawn + one `bob acp` process per gateway worker, with ACP sessions rooted at the + pre-trusted `/workspace` (`ACPBOX_ACP_WORKSPACE`). Run it with + `docker run -p 8080:8080 … bobshell acpbox` to expose Bob Shell behind an + OpenAI-style `/v1` API (default port 8080); both settings are overridable + with `-e`. (`--trust` is required: `bob acp` rejects untrusted workspaces + and does not read `trustedFolders.json`; since acpbox pins the session + cwd, only `/workspace` is trusted in practice.) - IBM license pre-accepted and `/workspace` pre-trusted at image build time, so `bob` never blocks on first-run prompts (see [trusted folders](https://bob.ibm.com/docs/shell/security/trusted-folders)). @@ -84,6 +94,12 @@ build time: docker build --build-arg BOB_VERSION=2.0.5 -t bobshell . ``` +acpbox can be pinned the same way: + +```bash +docker build --build-arg ACPBOX_VERSION=0.2.3 -t bobshell . +``` + ## Publishing (CI) `.github/workflows/build-bobshell.yml` builds `linux/amd64` and `linux/arm64`