-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
67 lines (63 loc) · 1.57 KB
/
docker-compose.test.yml
File metadata and controls
67 lines (63 loc) · 1.57 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
version: '3.8'
services:
app:
image: node:20-alpine
container_name: ${CONTAINER_NAME:-stack-test-app}
working_dir: /app
ports:
- "${APP_PORT:-3000}:3000"
environment:
- NODE_ENV=test
- PORT=3000
- DB_HOST=postgres
- DB_PORT=5432
- DB_NAME=testdb
- DB_USER=testuser
- DB_PASSWORD=testpass
- REDIS_HOST=redis
- REDIS_PORT=6379
command: sh -c "npm install && npm start"
volumes:
- ./mock-app:/app:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
interval: 2s
timeout: 5s
retries: 30
start_period: 10s
postgres:
image: postgres:16-alpine
container_name: ${CONTAINER_NAME_POSTGRES:-stack-test-postgres}
ports:
- "${POSTGRES_PORT:-5432}:5432"
environment:
- POSTGRES_DB=testdb
- POSTGRES_USER=testuser
- POSTGRES_PASSWORD=testpass
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U testuser -d testdb"]
interval: 2s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
container_name: ${CONTAINER_NAME_REDIS:-stack-test-redis}
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 5s
retries: 10
volumes:
postgres-data:
redis-data: