|
1 | 1 | # Makefile for Browser Operator Core |
2 | 2 | # Provides DevTools frontend + Agent Server deployments |
3 | 3 |
|
4 | | -.PHONY: help build devtools-up up down logs status chrome |
| 4 | +.PHONY: help build devtools-up up down logs status chrome chrome-clean |
| 5 | + |
| 6 | +# Chrome binary detection with cross-platform fallbacks |
| 7 | +# Override with: CHROME_BINARY=/path/to/chrome make chrome |
| 8 | +CHROME_BINARY ?= $(shell \ |
| 9 | + if command -v google-chrome >/dev/null 2>&1; then echo "google-chrome"; \ |
| 10 | + elif command -v chromium >/dev/null 2>&1; then echo "chromium"; \ |
| 11 | + elif command -v chromium-browser >/dev/null 2>&1; then echo "chromium-browser"; \ |
| 12 | + elif [ -x "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" ]; then echo "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"; \ |
| 13 | + elif [ -x "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then echo "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; \ |
| 14 | + else echo "chrome-not-found"; \ |
| 15 | + fi) |
| 16 | + |
| 17 | +# Chrome profile directory (cleaned before each run) |
| 18 | +CHROME_PROFILE ?= /tmp/browser-operator-chrome-profile |
5 | 19 |
|
6 | 20 | help: ## Show this help |
7 | 21 | @echo "Browser Operator Core - Docker Deployments" |
@@ -45,10 +59,21 @@ logs: ## Show logs |
45 | 59 | status: ## Show container status |
46 | 60 | @docker ps --filter "name=browser-operator" |
47 | 61 |
|
48 | | -chrome: ## Launch Chrome Canary with custom DevTools |
49 | | - "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" \ |
| 62 | +chrome-clean: ## Remove Chrome debug profile |
| 63 | + @rm -rf "$(CHROME_PROFILE)" |
| 64 | + @echo "Cleaned Chrome profile: $(CHROME_PROFILE)" |
| 65 | + |
| 66 | +chrome: chrome-clean ## Launch Chrome with custom DevTools (clean profile) |
| 67 | + @if [ "$(CHROME_BINARY)" = "chrome-not-found" ]; then \ |
| 68 | + echo "Error: No Chrome/Chromium binary found."; \ |
| 69 | + echo "Set CHROME_BINARY=/path/to/chrome make chrome"; \ |
| 70 | + exit 1; \ |
| 71 | + fi |
| 72 | + @echo "Using Chrome: $(CHROME_BINARY)" |
| 73 | + @echo "Profile: $(CHROME_PROFILE)" |
| 74 | + "$(CHROME_BINARY)" \ |
50 | 75 | --remote-debugging-port=9222 \ |
51 | 76 | --remote-allow-origins="*" \ |
52 | 77 | --auto-open-devtools-for-tabs \ |
53 | | - --user-data-dir=/tmp/chrome-debug-profile \ |
| 78 | + --user-data-dir="$(CHROME_PROFILE)" \ |
54 | 79 | --custom-devtools-frontend=http://localhost:8000/ |
0 commit comments