-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
98 lines (92 loc) · 2.58 KB
/
docker-compose.yml
File metadata and controls
98 lines (92 loc) · 2.58 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
version: "3.9"
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: echo-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-echo}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
POSTGRES_DB: ${POSTGRES_DB:-echo}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-echo} -d ${POSTGRES_DB:-echo}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- echo-network
# Redis (optional - for caching/sessions in growth phase)
redis:
image: redis:7-alpine
container_name: echo-redis
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD:-changeme}
volumes:
- redis_data:/data
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- echo-network
profiles:
- with-redis
# Next.js Application
app:
build:
context: .
dockerfile: Dockerfile
container_name: echo-app
restart: unless-stopped
ports:
- "${APP_PORT:-3000}:3000"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-echo}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-echo}
REDIS_URL: redis://:${REDIS_PASSWORD:-changeme}@redis:6379
NODE_ENV: production
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET}
BETTER_AUTH_URL: ${BETTER_AUTH_URL:-http://localhost:3000}
RESEND_API_KEY: ${RESEND_API_KEY}
OPENAI_API_KEY: ${OPENAI_API_KEY}
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- echo-network
# Migration service
migrate:
build: .
command: ["bun", "run", "db:migrate"]
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-echo}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-echo}
depends_on:
postgres:
condition: service_healthy
networks:
- echo-network
profiles:
- migrate
volumes:
postgres_data:
driver: local
redis_data:
driver: local
networks:
echo-network:
driver: bridge