-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
87 lines (81 loc) · 3.02 KB
/
Copy pathdocker-compose.yml
File metadata and controls
87 lines (81 loc) · 3.02 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
# Miku - Docker Compose
# Spins up PostgreSQL, the Discord bot, and the web dashboard.
#
# Usage:
# docker-compose up -d # Start all services
# docker-compose logs -f bot # Tail bot logs
# docker-compose down # Stop everything
#
# Before running, copy .env.example to .env and fill in your values.
version: "3.9"
x-logging: &default-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
services:
# ── PostgreSQL ──────────────────────────────────────────────────────
postgres:
image: postgres:17-alpine
container_name: miku-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-miku}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-miku_secret}
POSTGRES_DB: ${POSTGRES_DB:-miku}
volumes:
- pgdata:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init.sql:ro
ports:
- "127.0.0.1:5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-miku}"]
interval: 5s
timeout: 3s
retries: 5
logging: *default-logging
# ── Discord Bot ─────────────────────────────────────────────────────
bot:
build:
context: .
dockerfile: Dockerfile
container_name: miku-bot
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN:?err}
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-miku}:${POSTGRES_PASSWORD:-miku_secret}@postgres:5432/${POSTGRES_DB:-miku}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
TZ: UTC
command: ["python", "main.py"]
logging: *default-logging
# ── Web Dashboard ───────────────────────────────────────────────────
dashboard:
build:
context: .
dockerfile: Dockerfile
container_name: miku-dashboard
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
ports:
- "127.0.0.1:${DASHBOARD_PORT:-8000}:8000"
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-miku}:${POSTGRES_PASSWORD:-miku_secret}@postgres:5432/${POSTGRES_DB:-miku}
DASHBOARD_CLIENT_ID: ${DASHBOARD_CLIENT_ID:?err}
DASHBOARD_CLIENT_SECRET: ${DASHBOARD_CLIENT_SECRET:?err}
DASHBOARD_REDIRECT_URI: ${DASHBOARD_REDIRECT_URI:-http://localhost:8000/auth/callback}
DASHBOARD_SESSION_SECRET: ${DASHBOARD_SESSION_SECRET:?err}
DASHBOARD_HOST: "0.0.0.0"
DASHBOARD_PORT: "8000"
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN:?err}
TZ: UTC
command: >
sh -c "cd /app && uvicorn dashboard.backend.main:app --host 0.0.0.0 --port 8000"
logging: *default-logging
volumes:
pgdata:
driver: local