The Dockerfile installs Chromium via `playwright install chromium`, but Playwright MCP defaults to Chrome (the branded Google build) when no browser is specified. On a fresh container the launch fails and the agent falls back to installing Chrome at runtime. Baking the env var into the image keeps installed browser and default in sync.
39 lines
1.6 KiB
Docker
39 lines
1.6 KiB
Docker
FROM node:24-bookworm-slim
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends bash ca-certificates git ripgrep python3 python-is-python3 tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --ignore-scripts
|
|
COPY tsconfig.json tsconfig.build.json ./
|
|
COPY src ./src
|
|
RUN npm run build && npm prune --omit=dev
|
|
|
|
# Playwright browser + OS dependencies for the MCP bridge. Included
|
|
# unconditionally so PLAYWRIGHT_ENABLED=true works out of the box.
|
|
# Adds ~300 MB to the image. Only Chromium — other browsers pull extra deps.
|
|
RUN npx -y playwright install --with-deps chromium
|
|
|
|
# Claude Code CLI must be on PATH: pi-claude-code-provider shells out to `claude`.
|
|
RUN npm install -g @anthropic-ai/claude-code
|
|
|
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# Expose `pi` (and any other project-local bin) on PATH so `docker exec` finds it.
|
|
# PLAYWRIGHT_BROWSER=chromium matches the browser installed above — Playwright MCP
|
|
# otherwise defaults to Chrome (the branded Google build), which isn't in the image.
|
|
ENV PATH="/app/node_modules/.bin:${PATH}" \
|
|
NODE_ENV=production \
|
|
WORKSPACE_DIR=/workspace \
|
|
PI_CODING_AGENT_DIR=/pi-agent \
|
|
PLAYWRIGHT_BROWSER=chromium
|
|
VOLUME ["/workspace", "/pi-agent"]
|
|
|
|
# The node base image already sets ENTRYPOINT ["docker-entrypoint.sh"], and we replaced that
|
|
# script above at /usr/local/bin/docker-entrypoint.sh — so ours runs on every container start.
|
|
# Keep CMD as the app command so compose overrides (command: ["sleep","infinity"], ...) work.
|
|
CMD ["node", "dist/main.js"]
|