Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
70 lines (64 loc) · 1.71 KB
/
Copy pathdocker-compose.yml
File metadata and controls
70 lines (64 loc) · 1.71 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
# Production deployment for a single VPS.
#
# 1. Point an A record at this host.
# 2. Set DOMAIN and ACME_EMAIL in .env (see .env.example).
# 3. docker compose up -d --build
#
# Caddy terminates TLS with an automatically provisioned Let's Encrypt
# certificate and renews it without intervention. Neither application
# container publishes a port to the host -- only Caddy is reachable.
name: race-intelligence
services:
backend:
build:
context: ./backend
restart: unless-stopped
environment:
RI_DATABASE_URL: sqlite:////data/race_intelligence.db
RI_CORS_ORIGINS: '["https://${DOMAIN}"]'
RI_ANTHROPIC_API_KEY: ${RI_ANTHROPIC_API_KEY:-}
volumes:
- backend-data:/data
networks: [internal]
# Simulation is CPU-bound NumPy. Capping it stops a 50,000-race request
# from starving Caddy and the frontend on a small VPS.
deploy:
resources:
limits:
cpus: "1.5"
memory: 1G
frontend:
build:
context: ./frontend
args:
NEXT_PUBLIC_API_ORIGIN: http://backend:8000
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
networks: [internal]
deploy:
resources:
limits:
memory: 512M
caddy:
image: caddy:2-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
environment:
DOMAIN: ${DOMAIN}
ACME_EMAIL: ${ACME_EMAIL}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data # certificates -- losing this means re-issuing
- caddy-config:/config
depends_on: [frontend, backend]
networks: [internal]
networks:
internal:
volumes:
backend-data:
caddy-data:
caddy-config: