-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
executable file
·133 lines (124 loc) · 5.34 KB
/
docker-compose.yml
File metadata and controls
executable file
·133 lines (124 loc) · 5.34 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
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
# SmarterRouter Docker Compose Configuration
#
# GPU SUPPORT: Uncomment the section that matches your GPU setup below.
# SmarterRouter auto-detects GPUs on startup and logs what was found.
#
# QUICK START:
# - Build locally: docker compose build
# - NVIDIA: docker-compose --compatibility up -d
# - AMD: Comment out deploy section, uncomment devices section, then docker-compose up -d
# - Intel: Comment out deploy section, uncomment devices section, then docker-compose up -d
#
# CONFIGURATION:
# - Place your .env file in the project root or let auto-setup create one
# - The .env file will be mounted to /app/.env in the container
#
# IMPORTANT: The `deploy` section is ONLY for NVIDIA. AMD/Intel use `devices` at service level.
# See docs/docker-compose.amd.yml, docs/docker-compose.intel.yml for ready-to-use templates.
services:
smarterrouter:
image: ghcr.io/peva3/smarterrouter:latest
build:
context: .
dockerfile: Dockerfile
container_name: smarterrouter
ports:
- "11436:11436"
env_file:
- .env
volumes:
# Mount .env file from project root
# If .env doesn't exist on host, it will be created by auto-setup
- ./.env:/app/.env:rw
# Mount a data directory for persistence (safer than mounting individual files)
# Ensure the ./data directory exists and is writable by the container user (UID 1000).
# If running for the first time, create the directory and set permissions:
# mkdir -p ./data && chown 1000:1000 ./data
- ./data:/app/data:rw
# Optional: mount tmpfs for temporary files if needed
- type: tmpfs
target: /tmp
environment:
# Use persistent database location matching volume mount
- ROUTER_DATABASE_URL=sqlite:////app/data/router.db
restart: unless-stopped
networks:
- smarterrouter-network
# Health check
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:11436/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# =========================================================================
# GPU CONFIGURATION - Choose ONE section below
# =========================================================================
# -------------------------------------------------------------------------
# NVIDIA GPU (Default - Full Docker Support)
# -------------------------------------------------------------------------
# Requirements:
# - NVIDIA drivers installed on host
# - NVIDIA Container Toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
#
# Usage:
# docker-compose --compatibility up -d
# OR (newer Docker Compose): docker compose up -d --gpus all
#
# NOTE: For AMD or Intel GPUs, COMMENT OUT this entire deploy section!
#
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
# -------------------------------------------------------------------------
# AMD GPU (ROCm) - COMMENT OUT NVIDIA deploy section above first!
# -------------------------------------------------------------------------
# Requirements:
# - AMD GPU with ROCm support (RX 6000/7000, Radeon Instinct, Radeon Pro)
# - ROCm runtime installed: https://rocm.docs.amd.com/en/latest/deploy/linux/index.html
#
# IMPORTANT: Comment out the entire 'deploy' section above before uncommenting!
# The 'devices' section below goes at SERVICE level, NOT inside deploy.
#
# devices:
# - /dev/kfd # AMD Kernel Fusion Driver
# - /dev/dri # Direct Rendering Infrastructure
# environment:
# - ROCM_PATH=/opt/rocm # Optional: if using ROCm base image
# -------------------------------------------------------------------------
# Intel Arc GPU - COMMENT OUT NVIDIA deploy section above first!
# -------------------------------------------------------------------------
# Requirements:
# - Intel Arc A-series GPU (A380, A770, etc.)
# - Intel GPU drivers (i915 kernel module)
#
# IMPORTANT: Comment out the entire 'deploy' section above before uncommenting!
#
# devices:
# - /dev/dri # Direct Rendering Infrastructure
# environment:
# - LEVEL_ZERO_DEVICE=0 # Optional: For oneAPI/Level Zero
# -------------------------------------------------------------------------
# Multi-GPU (NVIDIA + AMD) - Keep deploy AND add devices
# -------------------------------------------------------------------------
# For systems with both NVIDIA and AMD GPUs, keep the deploy section
# AND uncomment the devices section below:
#
# devices:
# - /dev/kfd
# - /dev/dri
# -------------------------------------------------------------------------
# CPU-Only / No GPU
# -------------------------------------------------------------------------
# Comment out ALL GPU sections above and add to your .env:
# ROUTER_VRAM_MONITOR_ENABLED=false
# =========================================================================
# END GPU CONFIGURATION
# =========================================================================
networks:
smarterrouter-network:
driver: bridge