-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
115 lines (108 loc) · 2.74 KB
/
docker-compose.yml
File metadata and controls
115 lines (108 loc) · 2.74 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
services:
interview-postgres:
image: postgres:17.6
networks:
- interview-network
container_name: interview-postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: interview-db
volumes:
- postgres-data:/var/lib/postgresql/data
restart: always
ports:
- 5432:5432
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 30s
retries: 5
interview-pgadmin:
image: dpage/pgadmin4:latest
container_name: interview-pgadmin
restart: always
ports:
- 5050:80
networks:
- interview-network
environment:
PGADMIN_DEFAULT_EMAIL: admin@example.com
PGADMIN_DEFAULT_PASSWORD: admin
PGPASS_FILE: /pgpass/pgpass
volumes:
- pgadmin-data:/var/lib/pgadmin
- ./setup/pgadmin/servers.json:/pgadmin4/servers.json:ro
- ./setup/pgadmin/pgpass:/pgpass/pgpass:ro
depends_on:
interview-postgres:
condition: service_healthy
interview-redis:
container_name: interview-redis
image: redis:8.2.0
networks:
- interview-network
ports:
- 6379:6379
volumes:
- redis-data:/data
# saves DB every 60 seconds if at least 1 key changed
command: redis-server --save 60 1 --loglevel warning
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 3
app:
container_name: app
build:
context: .
dockerfile: Dockerfile.dev
networks:
- interview-network
environment:
NODE_ENV: development
PORT: 4000
DATABASE_URL: postgres://postgres:postgres@interview-postgres:5432/interview-db
REDIS_URL: redis://interview-redis:6379
# Make file watching reliable on macOS/Windows/docker-desktop
CHOKIDAR_USEPOLLING: '1'
WATCHPACK_POLLING: 'true'
WATCHPACK_POLLING_INTERVAL: '1000'
ports:
- 4000:4000
- 9229:9229
volumes:
- .:/app
- node_modules:/app/node_modules
depends_on:
interview-postgres:
condition: service_healthy
interview-redis:
condition: service_healthy
migration:
container_name: migration
build:
context: .
dockerfile: Dockerfile.dev
networks:
- interview-network
environment:
NODE_ENV: development
DATABASE_URL: postgres://postgres:postgres@interview-postgres:5432/interview-db
volumes:
- .:/app
- node_modules:/app/node_modules
command: npm run migrate
depends_on:
interview-postgres:
condition: service_healthy
app:
condition: service_started
volumes:
postgres-data:
pgadmin-data:
redis-data:
node_modules:
networks:
interview-network: