# E2E image for billion-context-pi.
#
# Pins a known Pi host version + Node major so the regression suite is
# reproducible regardless of whatever happens to be installed on the runner.
#
# The Pi host (@earendil-works/pi-coding-agent) is pinned by devDependencies
# in package.json (exact, no caret) and resolved via `npm ci` from the
# lockfile. Bump it there (and refresh package-lock.json) to move the suite
# to a newer Pi; CI will fail fast if the pinned version is unavailable.
#
# Build:  docker build -t bcp-e2e -f Dockerfile.e2e .
# Run:    docker run --rm bcp-e2e
# Filter: docker run --rm bcp-e2e 03-nudge
#
FROM node:22-slim

WORKDIR /app

# Install only the lockfile first for better layer caching.
COPY package.json package-lock.json ./
RUN npm ci

# Source + build the extension (produces dist/index.js).
COPY tsup.config.ts tsconfig.json ./
COPY src ./src
COPY scripts ./scripts
RUN npm run build

# Default entrypoint: run every scenario. Pass a substring arg to filter.
ENTRYPOINT ["./scripts/e2e/run-e2e.sh"]
