File size: 6,556 Bytes
2c7c9c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# ──────────────────────────────────────────────────────────────────────
#  OmniRoute β€” Docker Compose
# ──────────────────────────────────────────────────────────────────────
#
#  Profiles:
#    base  β†’ minimal image, no CLI tools
#    web   β†’ runner-web (+Chromium/Playwright) for web-cookie providers
#    cli   β†’ CLIs installed inside the container (portable)
#    host  β†’ runner-base + host-mounted CLI binaries (Linux-first)
#    cliproxyapi β†’ CLIProxyAPI sidecar on port 8317
#
#  Usage:
#    docker compose --profile base up -d
#    docker compose --profile web up -d   # gemini-web / claude-web / claude-turnstile
#    docker compose --profile cli up -d
#    docker compose --profile host up -d
#    docker compose --profile cliproxyapi up -d
#    docker compose --profile cli --profile cliproxyapi up -d
#
#  Before first run, copy .env.example β†’ .env and edit your secrets.
# ──────────────────────────────────────────────────────────────────────

x-common: &common
  restart: unless-stopped
  stop_grace_period: 40s
  env_file: .env
  environment:
    - DATA_DIR=/app/data # Must match the volume mount below
    - PORT=${PORT:-20128}
    - DASHBOARD_PORT=${DASHBOARD_PORT:-20128}
    - API_PORT=${API_PORT:-20129}
    - API_HOST=${API_HOST:-0.0.0.0}
    - REDIS_URL=${REDIS_URL:-redis://redis:6379}
  volumes:
    - ./data:/app/data
  healthcheck:
    test: ["CMD", "node", "healthcheck.mjs"]
    interval: 30s
    timeout: 5s
    retries: 3
    start_period: 15s

services:
  # ── Redis (Rate Limiter Backend) ──────────────────────────────────
  redis:
    image: docker.io/library/redis:7-alpine
    container_name: omniroute-redis
    restart: unless-stopped
    ports:
      - "${REDIS_PORT:-6379}:6379"
    volumes:
      - redis-data:/data
    command: redis-server --save 60 1 --loglevel warning
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 3

  # ── Profile: base (minimal, no CLI tools) ──────────────────────────
  omniroute-base:
    <<: *common
    container_name: omniroute
    build:
      context: .
      target: runner-base
    image: omniroute:base
    ports:
      - "${DASHBOARD_PORT:-20128}:${DASHBOARD_PORT:-20128}"
      - "${API_PORT:-20129}:${API_PORT:-20129}"
    profiles:
      - base

  # ── Profile: web (runner-web + Chromium/Playwright) ────────────────
  # Required for web-cookie providers (gemini-web, claude-web, claude-turnstile).
  # The default `base` image ships without Chromium, so those providers fail
  # with "Executable doesn't exist at .../ms-playwright/chromium..." (#2832).
  omniroute-web:
    <<: *common
    container_name: omniroute
    build:
      context: .
      target: runner-web
    image: omniroute:web
    ports:
      - "${DASHBOARD_PORT:-20128}:${DASHBOARD_PORT:-20128}"
      - "${API_PORT:-20129}:${API_PORT:-20129}"
    profiles:
      - web

  # ── Profile: cli (CLIs installed inside container) ─────────────────
  omniroute-cli:
    <<: *common
    container_name: omniroute
    build:
      context: .
      target: runner-cli
    image: omniroute:cli
    ports:
      - "${DASHBOARD_PORT:-20128}:${DASHBOARD_PORT:-20128}"
      - "${API_PORT:-20129}:${API_PORT:-20129}"
    volumes:
      - ./data:/app/data
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/libexec/docker/cli-plugins:/usr/libexec/docker/cli-plugins:ro
      - ${AUTO_UPDATE_HOST_REPO_DIR:-.}:/workspace/omniroute:rw
    profiles:
      - cli

  # ── Profile: host (host-mounted CLI binaries, Linux-first) ────────
  omniroute-host:
    <<: *common
    container_name: omniroute
    build:
      context: .
      target: runner-base
    image: omniroute:base
    ports:
      - "${DASHBOARD_PORT:-20128}:${DASHBOARD_PORT:-20128}"
      - "${API_PORT:-20129}:${API_PORT:-20129}"
    environment:
      - DATA_DIR=/app/data
      - PORT=${PORT:-20128}
      - DASHBOARD_PORT=${DASHBOARD_PORT:-20128}
      - API_PORT=${API_PORT:-20129}
      - API_HOST=${API_HOST:-0.0.0.0}
      - CLI_MODE=host
      - CLI_EXTRA_PATHS=/host-local/bin:/host-node/bin
      - CLI_CONFIG_HOME=/host-home
      - CLI_ALLOW_CONFIG_WRITES=true
      # Uncomment per-tool overrides as needed:
      # - CLI_CURSOR_BIN=agent
      # - CLI_CLINE_BIN=cline
      # - CLI_CONTINUE_BIN=cn
    volumes:
      - ./data:/app/data
      # ── Host binary mounts (read-only) ──
      # Adjust paths below to match YOUR host system.
      - ~/.local/bin:/host-local/bin:ro
      # Node global binaries (adjust node version path)
      # - ~/.nvm/versions/node/v24.14.1/bin:/host-node/bin:ro
      # ── Host config mounts (read-write) ──
      - ~/.codex:/host-home/.codex:rw
      - ~/.claude:/host-home/.claude:rw
      - ~/.factory:/host-home/.factory:rw
      - ~/.openclaw:/host-home/.openclaw:rw
      - ~/.cursor:/host-home/.cursor:rw
      - ~/.config/cursor:/host-home/.config/cursor:rw
    profiles:
      - host

  # ── Profile: cliproxyapi (CLIProxyAPI as sidecar) ─────────────────
  cliproxyapi:
    container_name: cliproxyapi
    image: ghcr.io/router-for-me/cliproxyapi:v6.9.7
    restart: unless-stopped
    ports:
      - "${CLIPROXYAPI_PORT:-8317}:${CLIPROXYAPI_PORT:-8317}"
    volumes:
      - cliproxyapi-data:/root/.cli-proxy-api
    environment:
      - PORT=${CLIPROXYAPI_PORT:-8317}
      - HOST=0.0.0.0
    healthcheck:
      test:
        ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:${CLIPROXYAPI_PORT:-8317}/v1/models"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s
    profiles:
      - cliproxyapi

volumes:
  cliproxyapi-data:
    name: cliproxyapi-data
  redis-data:
    name: omniroute-redis-data