-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
73 lines (70 loc) · 2.19 KB
/
docker-compose.yml
File metadata and controls
73 lines (70 loc) · 2.19 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
services:
template-db:
image: postgres:17
ports:
- "${DATABASE_PORT:-5432}:5432"
environment:
- POSTGRES_PASSWORD=${DATABASE_PW}
- POSTGRES_USER=${DATABASE_USER}
- POSTGRES_DB=${DATABASE_NAME}
volumes:
- template-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}"]
interval: 5s
timeout: 5s
retries: 5
# Database migrations (production only)
template-migrations:
build:
context: .
dockerfile: Dockerfile.migrations
environment:
- DATABASE_URL=postgresql://${DATABASE_USER}:${DATABASE_PW}@template-db:5432/${DATABASE_NAME}
restart: "no"
depends_on:
template-db:
condition: service_healthy
profiles:
- production
# Next.js application (production only)
template-app:
build:
context: .
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_VAPID_PUBLIC_KEY=${NEXT_PUBLIC_VAPID_PUBLIC_KEY}
- NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000}
ports:
- "${APP_PORT-3001:}3000"
environment:
- DATABASE_URL=postgresql://${DATABASE_USER}:${DATABASE_PW}@template-db:5432/${DATABASE_NAME}
- DATABASE_PW=${DATABASE_PW}
- DATABASE_USER=${DATABASE_USER}
- DATABASE_NAME=${DATABASE_NAME}
- DATABASE_HOST=template-db
- DATABASE_PORT=5432
- AUTH_SECRET=${AUTH_SECRET}
- AUTH_GOOGLE_ID=${AUTH_GOOGLE_ID}
- AUTH_GOOGLE_SECRET=${AUTH_GOOGLE_SECRET}
- RESEND_API_KEY=${RESEND_API_KEY}
- NEXT_PUBLIC_VAPID_PUBLIC_KEY=${NEXT_PUBLIC_VAPID_PUBLIC_KEY}
- VAPID_PRIVATE_KEY=${VAPID_PRIVATE_KEY}
- NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000}
- AUTH_TRUST_HOST=${AUTH_TRUST_HOST:-true}
command: node server.js
depends_on:
template-db:
condition: service_healthy
template-migrations:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
profiles:
- production
volumes:
template-db-data: