Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

implement Docker image support (P7 feature 3/3)

bot7bab2b6c8855
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..88d885f5
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,29 @@
+# Binaries
+pinchtab
+browser-bridge
+
+# Test coverage
+coverage.out
+*.test
+
+# Git
+.git/
+.github/
+
+# Local state
+.pinchtab/
+.openclaw/
+
+# macOS
+.DS_Store
+
+# Editor
+.vscode/
+*.swp
+
+# Docs
+docs/
+
+# Development
+node_modules/
+*.log
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..f6fb1e55
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,51 @@
+# Build stage
+FROM golang:1.25-alpine AS builder
+RUN apk add --no-cache git
+WORKDIR /build
+COPY go.mod go.sum ./
+RUN go mod download
+COPY . .
+RUN go build -ldflags="-s -w" -o pinchtab .
+
+# Runtime stage
+FROM alpine:latest
+
+# Install Chromium and dependencies
+RUN apk add --no-cache \
+ chromium \
+ nss \
+ freetype \
+ freetype-dev \
+ harfbuzz \
+ ca-certificates \
+ ttf-freefont \
+ dumb-init
+
+# Create non-root user
+RUN adduser -D -g '' pinchtab
+
+# Copy binary from builder
+COPY --from=builder /build/pinchtab /usr/local/bin/pinchtab
+
+# Create state directory
+RUN mkdir -p /data && chown pinchtab:pinchtab /data
+
+# Switch to non-root user
+USER pinchtab
+
+# Environment variables
+ENV BRIDGE_PORT=9867 \
+ BRIDGE_HEADLESS=true \
+ BRIDGE_STATE_DIR=/data \
+ BRIDGE_PROFILE=/data/chrome-profile \
+ CHROME_BINARY=/usr/bin/chromium-browser \
+ CHROME_FLAGS="--no-sandbox"
+
+# Expose port
+EXPOSE 9867
+
+# Use dumb-init to properly handle signals
+ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+
+# Run pinchtab
+CMD ["pinchtab"]
\ No newline at end of file
diff --git a/README.md b/README.md
index 0b9d4d6b..cffe58d2 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,13 @@ curl -X POST localhost:9867/action -d '{"kind":"click","ref":"e5"}'
## Quick Start
+### Docker (easiest)
+
+```bash
+docker run -d -p 9867:9867 --security-opt seccomp=unconfined pinchtab/pinchtab
+curl http://localhost:9867/health
+```
+
### With your AI agent
> Install Pinchtab and set it up for browser automation.
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 00000000..360c5dc9
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,24 @@
+version: '3.8'
+
+services:
+ pinchtab:
+ build: .
+ container_name: pinchtab
+ ports:
+ - "9867:9867"
+ volumes:
+ - pinchtab-data:/data
+ environment:
+ - BRIDGE_PORT=9867
+ - BRIDGE_HEADLESS=true
+ - BRIDGE_TOKEN=${PINCHTAB_TOKEN:-}
+ restart: unless-stopped
+ # Required for Chrome to work in container
+ security_opt:
+ - seccomp:unconfined
+ # Limit resources
+ mem_limit: 2g
+ cpus: '2.0'
+
+volumes:
+ pinchtab-data:
\ No newline at end of file
diff --git a/docs/docker.md b/docs/docker.md
new file mode 100644
index 00000000..17887490
--- /dev/null
+++ b/docs/docker.md
@@ -0,0 +1,93 @@
+# Docker Deployment
+
+Pinchtab includes a Docker image with bundled Chromium for easy deployment.
+
+## Quick Start
+
+### Using Docker Compose
+
+```bash
+# Clone the repository
+git clone https://github.com/pinchtab/pinchtab.git
+cd pinchtab
+
+# Start with docker-compose
+docker-compose up -d
+
+# Check logs
+docker-compose logs -f
+
+# Test
+curl http://localhost:9867/health
+```
+
+### Using Docker CLI
+
+```bash
+# Build image
+docker build -t pinchtab .
+
+# Run container
+docker run -d \
+ --name pinchtab \
+ -p 9867:9867 \
+ -v pinchtab-data:/data \
+ --security-opt seccomp=unconfined \
+ pinchtab
+
+# With auth token
+docker run -d \
+ --name pinchtab \
+ -p 9867:9867 \
+ -v pinchtab-data:/data \
+ -e BRIDGE_TOKEN=your-secret-token \
+ --security-opt seccomp=unconfined \
+ pinchtab
+```
+
+## Configuration
+
+Environment variables:
+- `BRIDGE_PORT` - HTTP port (default: 9867)
+- `BRIDGE_TOKEN` - Auth token (optional)
+- `BRIDGE_HEADLESS` - Run Chrome headless (default: true)
+- `BRIDGE_STATE_DIR` - State directory (default: /data)
+
+## Architecture
+
+The Docker image:
+- Uses Alpine Linux for minimal size
+- Includes Chromium browser
+- Runs as non-root user
+- Uses dumb-init for proper signal handling
+- Persists state in `/data` volume
+
+## Security Notes
+
+The container requires `--security-opt seccomp=unconfined` for Chrome to function properly. This is a limitation of running Chrome in containers.
+
+For production use:
+1. Always set `BRIDGE_TOKEN`
+2. Use a reverse proxy with TLS
+3. Limit container resources
+4. Run on isolated networks
+
+## Troubleshooting
+
+### Chrome crashes
+Increase memory limit:
+```yaml
+mem_limit: 4g
+```
+
+### Font issues
+The image includes basic fonts. For specific fonts:
+```dockerfile
+RUN apk add --no-cache ttf-liberation ttf-dejavu
+```
+
+### Performance
+For better performance:
+```yaml
+shm_size: '2gb' # Shared memory for Chrome
+```
\ No newline at end of file