forked from chenyme/grok2api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
107 lines (100 loc) · 3.82 KB
/
Copy pathdocker-compose.yml
File metadata and controls
107 lines (100 loc) · 3.82 KB
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
name: grok2api
services:
grok2api:
container_name: grok2api
image: "${GROK2API_IMAGE:-ghcr.io/chenyme/grok2api:latest}"
ports:
# S1: Bind ke 127.0.0.1 sahaja — gateway tidak lagi accessible dari luar network.
# Kalau perlu akses dari device lain, tukar balik ke "${GROK2API_PORT:-8000}:8000"
- "127.0.0.1:${GROK2API_PORT:-8000}:8000"
environment:
TZ: "${TZ:-Asia/Shanghai}"
# When non-empty, overrides the PostgreSQL DSN in config.yaml and enables postgres automatically.
GROK2API_DATABASE_URL: "${GROK2API_DATABASE_URL:-}"
GROK2API_QUALITY_GUARD_DIR: /var/lib/grok2api-quality-guard
volumes:
- "${GROK2API_CONFIG:-./config.yaml}:/run/grok2api/config.yaml:ro"
# Force English UI default (localStorage) before SPA boots
- "./runtime-config.js:/app/frontend/dist/runtime-config.js:ro"
- grok2api-data:/app/data
- quality_guard_state:/var/lib/grok2api-quality-guard
restart: unless-stopped
init: true
stop_grace_period: 30s
security_opt:
- no-new-privileges:true
# S3: Resource limits — docker compose (v2) sokong mem_limit/cpus
# secara terus (deploy.resources hanya untuk swarm).
mem_limit: 512m
cpus: 0.50
# Belt-and-suspenders with the Dockerfile HEALTHCHECK: makes service_healthy
# in depends_on work even when the image is swapped (e.g. upstream ghcr image).
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8000/healthz"]
interval: 30s
timeout: 5s
start_period: 15s
retries: 3
# Keep json-file logs bounded so long-running containers cannot fill the disk.
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# If the egress IP is not clean, uncomment the section below to use WARP as the exit proxy.
# After enabling, add socks5://warp:1080 in the admin UI under "Settings -> Egress Proxy".
# warp:
# container_name: warp
# image: caomingjun/warp:latest
# profiles: ["warp"]
# restart: unless-stopped
# ports:
# - "127.0.0.1:1080:1080"
# environment:
# - WARP_SLEEP=2
# cap_add:
# - NET_ADMIN
# ================================ FLARESOLVERR ================================
# In the admin UI, set the Clearance mode to FlareSolverr or on-demand refresh, and use http://flaresolverr:8191.
# Start command: docker compose --profile flaresolverr up -d
# Podman:podman compose --profile flaresolverr up -d
# flaresolverr:
# container_name: flaresolverr
# image: ghcr.io/flaresolverr/flaresolverr:latest
# profiles: ["flaresolverr"]
# environment:
# TZ: Asia/Shanghai
# LOG_LEVEL: info
# restart: unless-stopped
# ================================ EGRESS QUALITY GUARD ================================
# Optional Grok Build egress quality guard sidecar. Not started by default, and generates no probe requests.
# Before enabling, configure qualityGuard in config.yaml, then run:
# docker compose --profile quality-guard up -d --build
egress-quality-guard:
container_name: grok2api-egress-quality-guard
profiles: ["quality-guard"]
build:
context: .
dockerfile: tools/egress-quality-guard/Dockerfile
environment:
# Default matches the Compose service name. Override for host networking
# or a renamed grok2api service, e.g. http://127.0.0.1:8000
GROK2API_BASE_URL: ${GROK2API_BASE_URL:-http://grok2api:8000}
depends_on:
grok2api:
condition: service_healthy
volumes:
- quality_guard_state:/var/lib/grok2api-quality-guard
restart: "on-failure:5"
init: true
stop_grace_period: 30s
security_opt:
- no-new-privileges:true
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
grok2api-data:
quality_guard_state: