forked from elliotBraem/efizzybot
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (75 loc) · 1.91 KB
/
docker-compose.yml
File metadata and controls
82 lines (75 loc) · 1.91 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
services:
# DB service (shared configuration)
postgres:
image: postgres:15
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
profiles: ["dev"]
# Dev-specific postgres config
postgres_dev:
extends: postgres
container_name: postgres_dev
environment:
POSTGRES_DB: curatedotfun
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data # dev persists volumes, so you don't lose your setup
profiles: ["dev"]
# Test-specific postgres config
postgres_test:
extends: postgres
container_name: postgres_test
environment:
POSTGRES_DB: test
ports:
- "54321:5432"
# No volume for a fresh DB each time
profiles: ["test"]
# handles data migration and database seeding
db-migrate-dev:
build:
context: .
dockerfile: packages/shared-db/Dockerfile.dev
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres_dev:5432/curatedotfun
depends_on:
postgres_dev:
condition: service_healthy
profiles: ["dev"]
db-seed-dev:
extends: db-migrate-dev
command: ["seed:dev"]
profiles: ["dev"]
# Application service
app:
build:
context: .
dockerfile: apps/api/Dockerfile
depends_on:
postgres_prod:
condition: service_healthy
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres_prod:5432/curatedotfun
NODE_ENV: production
env_file:
- ./apps/api/.env
ports:
- "3000:3000"
profiles: ["prod"] # we can run the app profile to test a production run
volumes:
postgres_data:
redis_data:
node_modules_cache: # Add persistent volume for node_modules