refactor(browser): split browser cores via build ARG, add core selector (#237)

* refactor(browser): split browser cores via build ARG, add core selector

- Replace playwright official image with ubuntu:noble base in both
  docker/Dockerfile.browser and devenv/Dockerfile.browser; install
  browsers at build time driven by ARG/ENV BROWSER_CORES
- Add GET /cores endpoint to Browser Gateway reporting available cores
- Proxy GET /browser-contexts/cores in Go handler to Browser Gateway
- Add `core` field to BrowserContextConfigModel and GatewayBrowserContext;
  context creation selects the appropriate browser instance by core
- Frontend context-setting page fetches available cores and renders a
  core selector; saves core as part of the config JSON
- install.sh prompts for browser core selection and writes BROWSER_CORES
  to .env; builds the browser image locally before docker compose up
- Regenerate OpenAPI spec and TypeScript SDK

* fix: lint
This commit is contained in:
Acbox Liu
2026-03-14 12:37:20 +08:00
committed by GitHub
parent 627b673a5c
commit c8728ffc2c
22 changed files with 364 additions and 33 deletions
+13 -3
View File
@@ -1,7 +1,17 @@
FROM mcr.microsoft.com/playwright:v1.50.0-noble
FROM ubuntu:noble
ARG BROWSER_CORES=chromium,firefox
ENV BROWSER_CORES=$BROWSER_CORES
RUN apt-get update && apt-get install -y --no-install-recommends unzip curl nodejs npm && \
curl -fsSL https://bun.sh/install | bash && \
npm install -g playwright@1.50.0 && \
for core in $(echo "$BROWSER_CORES" | tr ',' ' '); do \
npx playwright install --with-deps "$core"; \
done && \
npm uninstall -g playwright && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends unzip && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:${PATH}"
WORKDIR /workspace