Skip to content

Commit b2231b1

Browse files
committed
Add new Docker file + instructions
1 parent da9897e commit b2231b1

4 files changed

Lines changed: 76 additions & 37 deletions

File tree

‎DOCKER.md‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,28 +164,37 @@ docker build -t llms-py:latest .
164164

165165
## Docker Compose
166166

167-
### Start Services
167+
### Using Pre-built Image (Recommended for Users)
168+
169+
The default `docker-compose.yml` uses the pre-built image from GitHub Container Registry:
168170

169171
```bash
172+
# Start services
170173
docker-compose up -d
171-
```
172-
173-
### View Logs
174174

175-
```bash
175+
# View logs
176176
docker-compose logs -f
177-
```
178-
179-
### Stop Services
180177

181-
```bash
178+
# Stop services
182179
docker-compose down
183180
```
184181

185-
### Rebuild and Restart
182+
### Building from Source (For Developers)
183+
184+
If you've cloned the repository and want to build from source, use `docker-compose.local.yml`:
186185

187186
```bash
188-
docker-compose up -d --build
187+
# Build and start services
188+
docker-compose -f docker-compose.local.yml up -d --build
189+
190+
# View logs
191+
docker-compose -f docker-compose.local.yml logs -f
192+
193+
# Stop services
194+
docker-compose -f docker-compose.local.yml down
195+
196+
# Rebuild and restart
197+
docker-compose -f docker-compose.local.yml up -d --build
189198
```
190199

191200
## Data Persistence

‎README.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ Run llms-py in a Docker container without installing Python or dependencies:
8080
docker pull ghcr.io/servicestack/llms:latest
8181

8282
# Run the server on port 8000
83-
docker run -p 8000:8000 \
84-
-e OPENROUTER_API_KEY=$OPENROUTER_API_KEY \
85-
-e GROQ_API_KEY=$GROQ_API_KEY \
86-
ghcr.io/servicestack/llms:latest
83+
docker run -p 8000:8000 -e OPENROUTER_API_KEY=$OPENROUTER_API_KEY ghcr.io/servicestack/llms:latest
8784
```
8885

8986
Or use docker-compose (recommended):
@@ -95,6 +92,7 @@ docker-compose up
9592
**Using docker-compose** (recommended for local development):
9693

9794
1. Create a `.env` file with your API keys:
95+
9896
```bash
9997
OPENROUTER_API_KEY=your-key
10098
GROQ_API_KEY=your-key

‎docker-compose.local.yml‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: '3.8'
2+
3+
services:
4+
llms:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
image: llms-py:latest
9+
container_name: llms-py
10+
ports:
11+
- "8000:8000"
12+
environment:
13+
# API Keys - Set these in your .env file or pass them directly
14+
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
15+
- GROQ_API_KEY=${GROQ_API_KEY:-}
16+
- GOOGLE_FREE_API_KEY=${GOOGLE_FREE_API_KEY:-}
17+
- GOOGLE_API_KEY=${GOOGLE_API_KEY:-}
18+
- CODESTRAL_API_KEY=${CODESTRAL_API_KEY:-}
19+
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
20+
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
21+
- GROK_API_KEY=${GROK_API_KEY:-}
22+
- DASHSCOPE_API_KEY=${DASHSCOPE_API_KEY:-}
23+
- ZAI_API_KEY=${ZAI_API_KEY:-}
24+
- MISTRAL_API_KEY=${MISTRAL_API_KEY:-}
25+
volumes:
26+
# Persist configuration and analytics data
27+
# The container will auto-create llms.json and ui.json on first run
28+
- llms-data:/home/llms/.llms
29+
30+
# Alternative: Mount a local directory to use custom config files
31+
# Uncomment the line below and comment out the line above to use local configs
32+
# Place your custom llms.json and ui.json in ./config/ directory
33+
# - ./config:/home/llms/.llms
34+
35+
# Alternative: Mount individual config files (read-only recommended)
36+
# - ./my-llms.json:/home/llms/.llms/llms.json:ro
37+
# - ./my-ui.json:/home/llms/.llms/ui.json:ro
38+
restart: unless-stopped
39+
healthcheck:
40+
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000').read()"]
41+
interval: 30s
42+
timeout: 10s
43+
retries: 3
44+
start_period: 5s
45+
46+
volumes:
47+
llms-data:
48+
driver: local
49+

‎docker-compose.yml‎

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ version: '3.8'
22

33
services:
44
llms:
5-
build:
6-
context: .
7-
dockerfile: Dockerfile
8-
image: llms-py:latest
9-
container_name: llms-server
5+
image: ghcr.io/servicestack/llms:latest
6+
container_name: llms-py
107
ports:
118
- "8000:8000"
129
environment:
@@ -23,27 +20,13 @@ services:
2320
- ZAI_API_KEY=${ZAI_API_KEY:-}
2421
- MISTRAL_API_KEY=${MISTRAL_API_KEY:-}
2522
volumes:
26-
# Persist configuration and analytics data
27-
# The container will auto-create llms.json and ui.json on first run
28-
- llms-data:/home/llms/.llms
29-
30-
# Alternative: Mount a local directory to use custom config files
31-
# Uncomment the line below and comment out the line above to use local configs
32-
# Place your custom llms.json and ui.json in ./config/ directory
33-
# - ./config:/home/llms/.llms
34-
35-
# Alternative: Mount individual config files (read-only recommended)
36-
# - ./my-llms.json:/home/llms/.llms/llms.json:ro
37-
# - ./my-ui.json:/home/llms/.llms/ui.json:ro
23+
# Maintain user-modifiable config files outside the container
24+
# llms.json and ui.json will be auto-created on first run
25+
- ~/.llms:/home/llms/.llms
3826
restart: unless-stopped
3927
healthcheck:
4028
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000').read()"]
4129
interval: 30s
4230
timeout: 10s
4331
retries: 3
4432
start_period: 5s
45-
46-
volumes:
47-
llms-data:
48-
driver: local
49-

0 commit comments

Comments
 (0)