fix(docker): resolve Pi runtime from peer dependency

This commit is contained in:
Pi Web Agent
2026-07-10 19:44:31 +00:00
parent d6cfffd70d
commit 3b2a225f87
7 changed files with 29 additions and 28 deletions
+11 -4
View File
@@ -26,14 +26,21 @@ RUN chmod 0755 /usr/local/sbin/install-pi-web-opensuse-base \
FROM base AS package
ARG PI_WEB_VERSION=latest
ARG PI_VERSION=latest
ARG CACHE_BUST=local
RUN set -eux; \
echo "PI WEB Docker build cache bust: ${CACHE_BUST}"; \
npm install -g --omit=dev --no-audit --no-fund \
"@jmfederico/pi-web@${PI_WEB_VERSION}" \
"@earendil-works/pi-coding-agent@${PI_VERSION}"; \
npm install -g --omit=dev --include=peer --no-audit --no-fund "@jmfederico/pi-web@${PI_WEB_VERSION}"; \
global_root="$(npm root -g)"; \
global_prefix="$(npm prefix -g)"; \
peer_pi_bin="${global_root}/@jmfederico/pi-web/node_modules/.bin/pi"; \
global_pi_bin="${global_prefix}/bin/pi"; \
if [ -x "${peer_pi_bin}" ]; then \
ln -sf "${peer_pi_bin}" "${global_pi_bin}"; \
elif [ ! -x "${global_pi_bin}" ]; then \
echo "Could not find pi binary from @earendil-works/pi-coding-agent" >&2; \
exit 1; \
fi; \
npm cache clean --force
FROM base AS runtime
+7 -10
View File
@@ -55,7 +55,7 @@ Defaults:
- install directory: `~/.local/share/pi-web-docker` (or `$XDG_DATA_HOME/pi-web-docker`);
- persistent data: `<install-dir>/data`, mounted at `/data`;
- browser URL: <http://127.0.0.1:8504>;
- npm packages: latest `@jmfederico/pi-web` and latest Pi Coding Agent package unless pinned.
- npm packages: latest `@jmfederico/pi-web`; Pi Coding Agent is resolved as PI WEB's npm peer dependency (newest compatible version) and the peer-provided `pi` binary is linked into the image.
Updating recreates the Docker `sessiond` container. Active Pi agent runtimes in this Docker install may stop, so update while sessions are idle. Persisted PI WEB state, Pi config, and session history under the data directory are kept.
@@ -93,8 +93,7 @@ curl -fsSL https://raw.githubusercontent.com/jmfederico/pi-web/main/docker/insta
--data-dir ~/.local/share/pi-web-docker/data \
--bind-address 127.0.0.1 \
--port 8504 \
--pi-web-version latest \
--pi-version latest
--pi-web-version latest
```
Common environment variables written to `.env`:
@@ -109,8 +108,7 @@ Common environment variables written to `.env`:
| `PI_WEB_DOCKER_HOST_PROFILE`, `HOSTEXEC_MODE` | detected host profile and host-command capability toggle |
| `PI_WEB_DOCKER_EXTRA_HOST_PATHS` | optional whitespace-separated existing absolute paths to bind-mount read/write at the same path |
| `PI_WEB_BIND_ADDR`, `PI_WEB_PORT` | host bind address and port |
| `PI_WEB_VERSION` | npm version/range for `@jmfederico/pi-web` |
| `PI_VERSION` | npm version/range for `@earendil-works/pi-coding-agent` |
| `PI_WEB_VERSION` | npm version/range for `@jmfederico/pi-web`; Pi Coding Agent resolves from PI WEB's npm peer dependency |
| `PI_WEB_OPENSUSE_IMAGE` | openSUSE base image used for the runtime build |
| `PI_WEB_NODEJS_MAJOR` | Node.js major package to install, defaulting to `22` |
| `PI_WEB_NODEJS_REPO` | Node.js zypper repository URL, `auto`, or `disabled` |
@@ -119,7 +117,7 @@ Common environment variables written to `.env`:
| `COMPOSE_PROJECT_NAME` | Docker Compose project name used by the runtime and its detached update/restart helpers; defaults to `pi-web` |
| `HOSTEXEC_IMAGE` | helper image used by `hostexec` |
Host-derived IDs and the Docker host profile are refreshed on rerun unless you explicitly override the IDs. User-facing values such as data directory, bind address, port, image names, upload limit, extra host paths, base image, Node.js settings, extra packages, and version pins are preserved from an existing `.env` unless you pass a flag or environment override.
Host-derived IDs and the Docker host profile are refreshed on rerun unless you explicitly override the IDs. User-facing values such as data directory, bind address, port, image names, upload limit, extra host paths, base image, Node.js settings, extra packages, and npm package selection are preserved from an existing `.env` unless you pass a flag or environment override.
The installer also writes a generated `compose.override.yml` in the install directory. `pi-web-docker` loads the generated `.env` and Compose override explicitly for runtime commands and passes the generated `COMPOSE_PROJECT_NAME` to Docker Compose, so an unrelated ambient Compose project name cannot redirect lifecycle commands. Re-run `pi-web-docker install` or `pi-web-docker update` instead of editing generated files by hand.
@@ -173,21 +171,20 @@ Files in that development hook directory are ignored by Git except for the place
### Version pinning
Pin npm package versions when you want repeatable rebuilds:
Pi Coding Agent is resolved from PI WEB's npm peer dependency, and Docker links the peer-provided `pi` binary into `PATH`. Pin the PI WEB npm package when you want to stay on a specific PI WEB release:
```bash
curl -fsSL https://raw.githubusercontent.com/jmfederico/pi-web/main/docker/install.sh \
| sh -s -- --pi-web-version 1.202606.4 --pi-version 0.79.1
| sh -s -- --pi-web-version 1.202606.4
```
You can also edit `.env` in the install directory:
```dotenv
PI_WEB_VERSION=1.202606.4
PI_VERSION=0.79.1
```
Then rerun the one-liner to rebuild/recreate with those pins. Use `latest` again when you want the runtime to track the newest npm releases.
Then rerun the one-liner to rebuild/recreate with that pin. Use `PI_WEB_VERSION=latest` when you want the runtime to track the newest PI WEB release and the newest Pi package compatible with PI WEB's peer dependency range.
To pin the Docker asset templates themselves, fetch the installer from a specific Git branch, tag, or commit and pass the same ref as the asset source:
-1
View File
@@ -11,7 +11,6 @@ x-pi-web-build: &pi-web-build
PI_WEB_UID: ${PI_WEB_UID:-1000}
PI_WEB_GID: ${PI_WEB_GID:-1000}
PI_WEB_VERSION: ${PI_WEB_VERSION:-latest}
PI_VERSION: ${PI_VERSION:-latest}
CACHE_BUST: ${CACHE_BUST:-local}
x-pi-web-environment: &pi-web-environment
+2 -12
View File
@@ -27,8 +27,6 @@ Options:
--bind-address ADDR Host bind address (default: 127.0.0.1)
--port PORT Host port (default: 8504)
--pi-web-version VER npm @jmfederico/pi-web version pin (default: latest)
--pi-version VER npm @earendil-works/pi-coding-agent version pin
(default: latest)
--opensuse-image IMAGE openSUSE base image (default: opensuse/tumbleweed)
--nodejs-major MAJOR Node.js major version package to install (default: 22)
--nodejs-repo REPO Node.js zypper repository URL, auto, or disabled
@@ -49,7 +47,7 @@ Progressive host setup:
Environment variables with the same names used in .env may also be set before
running the installer, for example:
PI_WEB_VERSION=1.202606.4 PI_VERSION=0.79.1 docker/install.sh
PI_WEB_VERSION=1.202606.4 docker/install.sh
EOF
}
@@ -80,11 +78,6 @@ while [ "$#" -gt 0 ]; do
PI_WEB_VERSION=$2
shift 2
;;
--pi-version)
[ "$#" -ge 2 ] || die "--pi-version requires a value"
PI_VERSION=$2
shift 2
;;
--opensuse-image)
[ "$#" -ge 2 ] || die "--opensuse-image requires a value"
PI_WEB_OPENSUSE_IMAGE=$2
@@ -372,7 +365,6 @@ data_dir=$(absolute_dir "$(path_from_base "$install_dir" "$raw_data_dir")") || d
pi_web_bind_addr=$(value_from_env_or_existing_or_default PI_WEB_BIND_ADDR 127.0.0.1)
pi_web_port=$(value_from_env_or_existing_or_default PI_WEB_PORT 8504)
pi_web_version=$(value_from_env_or_existing_or_default PI_WEB_VERSION latest)
pi_version=$(value_from_env_or_existing_or_default PI_VERSION latest)
pi_web_opensuse_image=$(value_from_env_or_existing_or_default PI_WEB_OPENSUSE_IMAGE opensuse/tumbleweed)
pi_web_nodejs_major=$(value_from_env_or_existing_or_default PI_WEB_NODEJS_MAJOR 22)
pi_web_nodejs_repo=$(value_from_env_or_existing_or_default PI_WEB_NODEJS_REPO auto)
@@ -394,7 +386,6 @@ require_non_empty PI_WEB_DOCKER_REF "$asset_ref"
require_non_empty PI_WEB_BIND_ADDR "$pi_web_bind_addr"
require_non_empty PI_WEB_PORT "$pi_web_port"
require_non_empty PI_WEB_VERSION "$pi_web_version"
require_non_empty PI_VERSION "$pi_version"
require_non_empty PI_WEB_OPENSUSE_IMAGE "$pi_web_opensuse_image"
require_non_empty PI_WEB_NODEJS_MAJOR "$pi_web_nodejs_major"
require_non_empty PI_WEB_NODEJS_REPO "$pi_web_nodejs_repo"
@@ -434,9 +425,8 @@ PI_WEB_DOCKER_REF=$asset_ref
PI_WEB_BIND_ADDR=$pi_web_bind_addr
PI_WEB_PORT=$pi_web_port
# npm version pins. Use latest for quick updates, or set concrete versions.
# npm package selection. Pi resolves from PI WEB's npm peer dependency.
PI_WEB_VERSION=$pi_web_version
PI_VERSION=$pi_version
# openSUSE/Node.js image build inputs.
PI_WEB_OPENSUSE_IMAGE=$pi_web_opensuse_image
+1 -1
View File
@@ -626,7 +626,7 @@ start_detached_helper() {
timestamp=$(date -u +%Y%m%d%H%M%S)
helper_name=pi-web-docker-$action-$timestamp-$$
generated_env_keys="PI_WEB_UID PI_WEB_GID DOCKER_GID PI_WEB_DOCKER_HOST_PROFILE HOSTEXEC_MODE PI_WEB_DOCKER_EXTRA_HOST_PATHS PI_WEB_DOCKER_DATA_DIR PI_WEB_DOCKER_INSTALL_DIR PI_WEB_DOCKER_DEV_REPO_ROOT PI_WEB_DOCKER_REF PI_WEB_BIND_ADDR PI_WEB_PORT PI_WEB_DEV_API_BIND_ADDR PI_WEB_DEV_BIND_ADDR PI_WEB_DEV_API_PORT PI_WEB_DEV_PORT PI_WEB_VERSION PI_VERSION PI_WEB_OPENSUSE_IMAGE PI_WEB_NODEJS_MAJOR PI_WEB_NODEJS_REPO PI_WEB_EXTRA_ZYPPER_PACKAGES PI_WEB_IMAGE PI_WEB_DEV_IMAGE COMPOSE_PROJECT_NAME HOSTEXEC_IMAGE PI_WEB_MAX_UPLOAD_BYTES"
generated_env_keys="PI_WEB_UID PI_WEB_GID DOCKER_GID PI_WEB_DOCKER_HOST_PROFILE HOSTEXEC_MODE PI_WEB_DOCKER_EXTRA_HOST_PATHS PI_WEB_DOCKER_DATA_DIR PI_WEB_DOCKER_INSTALL_DIR PI_WEB_DOCKER_DEV_REPO_ROOT PI_WEB_DOCKER_REF PI_WEB_BIND_ADDR PI_WEB_PORT PI_WEB_DEV_API_BIND_ADDR PI_WEB_DEV_BIND_ADDR PI_WEB_DEV_API_PORT PI_WEB_DEV_PORT PI_WEB_VERSION PI_WEB_OPENSUSE_IMAGE PI_WEB_NODEJS_MAJOR PI_WEB_NODEJS_REPO PI_WEB_EXTRA_ZYPPER_PACKAGES PI_WEB_IMAGE PI_WEB_DEV_IMAGE COMPOSE_PROJECT_NAME HOSTEXEC_IMAGE PI_WEB_MAX_UPLOAD_BYTES"
set -- run -d \
--env-file "$env_file" \