Skip to content

Commit 5cd243d

Browse files
Daedaeliusclaude
andcommitted
Make chrome target cross-platform with clean profile
- Add CHROME_BINARY detection with fallbacks: 1. CHROME_BINARY env var (user override) 2. google-chrome (Linux) 3. chromium (Linux) 4. chromium-browser (Linux/Debian) 5. Chrome Canary (macOS) 6. Chrome (macOS) - Add CHROME_PROFILE variable for profile directory - Add chrome-clean target to remove profile before launch - chrome now depends on chrome-clean for fresh profile each run - Error message if no Chrome binary found 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 113aa0b commit 5cd243d

1 file changed

Lines changed: 29 additions & 4 deletions

File tree

docker/Makefile

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
# Makefile for Browser Operator Core
22
# Provides DevTools frontend + Agent Server deployments
33

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
519

620
help: ## Show this help
721
@echo "Browser Operator Core - Docker Deployments"
@@ -45,10 +59,21 @@ logs: ## Show logs
4559
status: ## Show container status
4660
@docker ps --filter "name=browser-operator"
4761

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)" \
5075
--remote-debugging-port=9222 \
5176
--remote-allow-origins="*" \
5277
--auto-open-devtools-for-tabs \
53-
--user-data-dir=/tmp/chrome-debug-profile \
78+
--user-data-dir="$(CHROME_PROFILE)" \
5479
--custom-devtools-frontend=http://localhost:8000/

0 commit comments

Comments
 (0)