@@ -45,8 +45,9 @@ RUN curl -fsSL https://bun.sh/install | bash
4545RUN ln -sf /usr/local/bun/bin/bun /usr/local/bin/bun
4646RUN script -q -e -c "bun add -g @openai/codex@latest" /dev/null
4747RUN ln -sf /usr/local/bun/bin/codex /usr/local/bin/codex
48- ${ config . enableMcpPlaywright
49- ? `RUN npm install -g @playwright/mcp@latest
48+ ${
49+ config . enableMcpPlaywright
50+ ? `RUN npm install -g @playwright/mcp@latest
5051
5152# docker-git: wrapper that converts a CDP HTTP endpoint into a usable WS endpoint
5253# Some Chromium images return webSocketDebuggerUrl pointing at 127.0.0.1 (container-local).
7071
7172# kechangdev/browser-vnc binds Chromium CDP on 127.0.0.1:9222; it also host-checks HTTP requests.
7273JSON="$(curl -sSf --connect-timeout 3 --max-time 10 -H 'Host: 127.0.0.1:9222' "\${CDP_ENDPOINT%/}/json/version")"
73- WS_URL="$(printf "%s" "$JSON" | node -e 'const fs=require(\ "fs\ "); const j=JSON.parse(fs.readFileSync(0,\ "utf8\ ")); process.stdout.write(j.webSocketDebuggerUrl || \"\ ")')"
74+ WS_URL="$(printf "%s" "$JSON" | node -e 'const fs=require("fs"); const j=JSON.parse(fs.readFileSync(0,"utf8")); process.stdout.write(j.webSocketDebuggerUrl || " ")')"
7475if [[ -z "$WS_URL" ]]; then
7576 echo "docker-git-playwright-mcp: webSocketDebuggerUrl missing" >&2
7677 exit 1
7778fi
7879
7980# Rewrite ws origin to match the CDP endpoint origin (docker DNS).
80- BASE_WS="$(CDP_ENDPOINT="$CDP_ENDPOINT" node -e 'const { URL } = require(\ "url\ "); const u=new URL(process.env.CDP_ENDPOINT); const proto=u.protocol===\ "https:\"?\ "wss:\":\ "ws:\ "; process.stdout.write(proto + \ "//\ " + u.host)')"
81- WS_REWRITTEN="$(BASE_WS="$BASE_WS" WS_URL="$WS_URL" node -e 'const { URL } = require(\ "url\ "); const base=new URL(process.env.BASE_WS); const ws=new URL(process.env.WS_URL); ws.protocol=base.protocol; ws.host=base.host; process.stdout.write(ws.toString())')"
81+ BASE_WS="$(CDP_ENDPOINT="$CDP_ENDPOINT" node -e 'const { URL } = require("url"); const u=new URL(process.env.CDP_ENDPOINT); const proto=u.protocol==="https:"? "wss:": "ws:"; process.stdout.write(proto + "//" + u.host)')"
82+ WS_REWRITTEN="$(BASE_WS="$BASE_WS" WS_URL="$WS_URL" node -e 'const { URL } = require("url"); const base=new URL(process.env.BASE_WS); const ws=new URL(process.env.WS_URL); ws.protocol=base.protocol; ws.host=base.host; process.stdout.write(ws.toString())')"
8283
8384EXTRA_ARGS=()
8485if [[ "\${MCP_PLAYWRIGHT_ISOLATED:-1}" == "1" ]]; then
8889exec playwright-mcp --cdp-endpoint "$WS_REWRITTEN" "\${EXTRA_ARGS[@]}" "$@"
8990EOF
9091RUN chmod +x /usr/local/bin/docker-git-playwright-mcp`
91- : "" }
92+ : ""
93+ }
9294RUN printf "export BUN_INSTALL=/usr/local/bun\\nexport PATH=/usr/local/bun/bin:$PATH\\n" \
9395 > /etc/profile.d/bun.sh && chmod 0644 /etc/profile.d/bun.sh`
9496
@@ -303,14 +305,14 @@ const renderConfigJson = (config: TemplateConfig): string =>
303305export const planFiles = ( config : TemplateConfig ) : ReadonlyArray < FileSpec > => {
304306 const maybePlaywrightFiles = config . enableMcpPlaywright
305307 ? ( [
306- { _tag : "File" , relativePath : "Dockerfile.browser" , contents : renderPlaywrightBrowserDockerfile ( ) } ,
307- {
308- _tag : "File" ,
309- relativePath : "mcp-playwright-start-extra.sh" ,
310- contents : renderPlaywrightStartExtra ( ) ,
311- mode : 0o755
312- }
313- ] satisfies ReadonlyArray < FileSpec > )
308+ { _tag : "File" , relativePath : "Dockerfile.browser" , contents : renderPlaywrightBrowserDockerfile ( ) } ,
309+ {
310+ _tag : "File" ,
311+ relativePath : "mcp-playwright-start-extra.sh" ,
312+ contents : renderPlaywrightStartExtra ( ) ,
313+ mode : 0o755
314+ }
315+ ] satisfies ReadonlyArray < FileSpec > )
314316 : ( [ ] satisfies ReadonlyArray < FileSpec > )
315317
316318 return [
0 commit comments