-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
63 lines (60 loc) · 2.02 KB
/
docker-compose.yml
File metadata and controls
63 lines (60 loc) · 2.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
# Docker Compose for Routa.js
#
# Default profile: SQLite (no external database needed)
# docker compose up
#
# Postgres profile: uses a bundled Postgres container
# docker compose --profile postgres up
#
# Production Postgres (external):
# Set DATABASE_URL in .env before running `docker compose up`.
services:
# ── Next.js application ──────────────────────────────────────────────────
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
# SQLite mode (default) — no external DB required
ROUTA_DB_DRIVER: ${ROUTA_DB_DRIVER:-sqlite}
ROUTA_DB_PATH: /app/data/routa.db
# Set DATABASE_URL (and ROUTA_DB_DRIVER=postgres) in .env to use Postgres.
# Example for the bundled postgres service:
# DATABASE_URL=postgresql://routa:routa_secret@postgres:5432/routa
DATABASE_URL: ${DATABASE_URL:-}
volumes:
- routa_data:/app/data
depends_on:
postgres:
condition: service_healthy
required: false # only enforced when the postgres profile is active
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# ── PostgreSQL (optional) ─────────────────────────────────────────────────
postgres:
image: postgres:16-alpine
profiles:
- postgres
environment:
POSTGRES_DB: routa
POSTGRES_USER: routa
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-routa_secret} # change for production
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U routa -d routa"]
interval: 10s
timeout: 5s
retries: 5
volumes:
routa_data:
postgres_data: