Files
ework-agent 67eeb303aa feat(gate): containerized full real-model gate + config-driven launcher
The full real-model gate (A compression / B model switch / U registry /
I install / X auto-update / P host-plugin lanes / R restart kill matrix)
moves into this repo so the lane logic versions with the code under test
and remote CI can run the SAME scripts from the candidate checkout.
Lanes I/X/R and the A/B model calls need a real model endpoint, so they
remain operator-run via the new launcher; ci-gate-plugins.yml keeps
driving Lane P.

- Dockerfile: node:22-slim + the host CLIs pinned to the versions this
  repo's own CI uses (dsh / pi / codex / opencode / claude / opencode-v1)
- entrypoint.sh: build the candidate rev, in-container ephemeral verdaccio
  (lanes U/I/X, no host registry dependency), keyed-API shims, then run
  release-gate-local (A/B/U) + plugin-lanes (P) + restart-lanes (R) +
  docker-lanes (I/X) and roll up one GREEN/RED
- docker-lanes.mjs / restart-lanes.mjs / patch-gate.mjs /
  verdaccio.config.yaml: the lane drivers and shims
- bili-gate.sh: config-driven launcher — scripts/gate/bili-gate.sh
  --config <path> [--rev REF] [--skip ...] [--keep] [--dry-run]. ALL
  host-specific facts (model endpoints, API keys, npm registry, git
  proxy/mirror, out dir) live in the local JSON config only; nothing
  machine-specific is committed here (config.example.json is
  placeholders). The stale-image guard from the old host wrapper comes
  along: on build failure the existing image is reused only after
  byte-comparing every /gate-tools lane script, drift = FATAL.
- README(.zh-CN): full lane table + the endpoint/secret contract +
  how-to-run; the old 'the containerized wrapper lives outside this repo'
  section is retired
2026-11-15 14:38:50 +08:00

74 lines
3.4 KiB
Docker

# billion-context real-model gate container
#
# Self-contained: clone + build master, run the release gate (real compression /
# model switch / cache / install / auto-update) against whatever model API the
# runner passes in. Works identically on any Linux Docker host and on Docker
# Desktop for Windows — the only inputs are env vars.
#
# docker build -t bili-gate .
# docker run --rm \
# -e MODEL1_BASE_URL=... -e MODEL1_MODEL=... -e MODEL1_API_KEY=... \
# -e MODEL2_BASE_URL=... -e MODEL2_MODEL=... -e MODEL2_API_KEY=... \
# -v "$PWD/out:/work" bili-gate
#
# MODEL1 = primary lane (compression / fold / cache) [required]
# MODEL2 = second DIFFERENT upstream for the switch lane [optional; Lane B skipped if absent]
FROM node:22-slim
# git — clone the repo under test (build-info stamps the commit)
# curl — verdaccio user bootstrap
# ca-certificates — https to npm / model APIs
# APT_MIRROR lets slow regions swap deb.debian.org for a nearby mirror
# (build arg only — the published default stays the official source).
ARG APT_MIRROR=""
RUN if [ -n "$APT_MIRROR" ]; then \
sed -i "s|deb.debian.org|$APT_MIRROR|g; s|security.debian.org|$APT_MIRROR|g" \
/etc/apt/sources.list.d/debian.sources; \
fi \
&& apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# Toolchain pinned to the surfaces the gate relies on:
# - dsh 0.2.0-rc.2 = the CLI surface scripts/release-gate-local.mjs drives
# (`dsh --profile <n> headless --json --session-id`)
# - pnpm 9 = what dsh profiles use to materialize node_modules
# - verdaccio = in-container registry for the install/update lanes (no host deps)
# Host CLIs for the plugin lanes (Lane P) — pinned to the same versions the
# repo's own CI uses (ci-e2e-pi-ws/codex-persona/native-opencode) so the gate
# tests the same surfaces the project tests:
# - pi-stable: NOTE the package ships only the `pi-stable` bin; the canonical
# `pi` symlink to dist/cli.js is created below (same as CI).
# - codex 0.147.0 = the pinned persona-lane version (#815)
# - opencode v2=2.0.20 global; v1=1.14.47 in /opt (the v1 line lives in the
# `opencode-ai` package — @opencode/cli 1.x/2.x are the v2 line; same bin
# name, so v1 is installed into a separate prefix as `opencode-v1`)
# - claude-code = anthropic-wire host for protocol coverage
ARG CLAUDE_CODE_VERSION=2.0.76
RUN npm install -g --no-audit --no-fund \
pnpm@12.4.2 \
@deepseek-ai/dsh@0.2.0-rc.2 \
verdaccio@6.10.5 \
pi-stable@0.83.6 \
@openai/codex@0.147.0 \
@opencode/cli@2.0.20 \
@anthropic-ai/claude-code@${CLAUDE_CODE_VERSION} \
&& ln -sf "$(npm root -g)/pi-stable/dist/cli.js" /usr/local/bin/pi \
&& mkdir -p /opt/opencode-v1 \
&& npm install --prefix /opt/opencode-v1 --no-audit --no-fund opencode-ai@1.14.47 \
&& ln -sf /opt/opencode-v1/node_modules/.bin/opencode /usr/local/bin/opencode-v1
ENV LANG=C.UTF-8
ENV HOME=/root
ENV GATE_REPO_URL=https://github.com/ranxianglei/billion-context.git
ENV GATE_REV=master
# opencode v1 lives at /opt (bin name clash with the v2 global)
ENV GATE_OC1_BIN=opencode-v1
# gate-tools = the orchestrator + container-only lanes (COPY'd, not cloned)
RUN mkdir -p /gate /gate-tools /work
COPY entrypoint.sh docker-lanes.mjs plugin-lanes.mjs restart-lanes.mjs upstream-recorder.mjs patch-gate.mjs verdaccio.config.yaml /gate-tools/
ENTRYPOINT ["/bin/bash", "/gate-tools/entrypoint.sh"]