feat: add browser support for provider OAuth in Docker

Docker changes:
- Install Node.js and npm (for Claude CLI)
- Install Firefox ESR for browser-based OAuth
- Install X11 libraries for display forwarding
- Add 'setup' service with display access

Usage:
  xhost +local:docker
  docker-compose run --rm setup
  smarttools providers install

The 'setup' service has DISPLAY and X11 socket access, so browser-based
OAuth flows (Claude, Codex, Gemini, OpenCode) can work inside Docker.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rob 2025-12-29 13:15:13 -04:00
parent 9d3b65118d
commit 6106b7837a
2 changed files with 36 additions and 0 deletions

View File

@ -11,6 +11,15 @@ LABEL description="SmartTools - Personal AI-powered CLI command builder"
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
git \ git \
curl \ curl \
# Node.js for Claude CLI
nodejs \
npm \
# Browser for OAuth authentication
firefox-esr \
# X11 libraries for display
libx11-6 \
libxext6 \
libxrender1 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Set working directory # Set working directory

View File

@ -48,6 +48,26 @@ services:
stdin_open: true stdin_open: true
tty: true tty: true
# ============================================================================
# Setup (with display for browser-based auth)
# ============================================================================
# Use this for installing providers that need browser authentication
# First run: xhost +local:docker
setup:
build:
context: .
dockerfile: Dockerfile
image: smarttools:latest
environment:
- DISPLAY=${DISPLAY:-:0}
volumes:
- smarttools-data:/root/.smarttools
- /tmp/.X11-unix:/tmp/.X11-unix:ro
command: ["/bin/bash"]
stdin_open: true
tty: true
network_mode: host
volumes: volumes:
smarttools-data: smarttools-data:
# Persists ~/.smarttools between container runs # Persists ~/.smarttools between container runs
@ -68,3 +88,10 @@ volumes:
# #
# Interactive shell: # Interactive shell:
# docker-compose run --rm shell # docker-compose run --rm shell
#
# Install providers (with browser auth):
# xhost +local:docker
# docker-compose run --rm setup
# # Inside container:
# smarttools providers install # Interactive guide
# # Select a provider, it will install and open browser for auth