-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
70 lines (63 loc) · 1.45 KB
/
docker-compose.yml
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
version: "3"
services:
base-api: &base-api
build:
context: .
dockerfile: Dockerfile
volumes:
- ./src:/home/node/app/src
- ./prisma:/home/node/app/prisma
- ./package.json:/home/node/app/package.json
- ./pnpm-lock.yaml:/home/node/app/pnpm-lock.yaml
api:
container_name: api
<<: *base-api
ports:
- "3333:3333"
env_file:
- ./.env
command: ["sh", "-c", "pnpm prisma migrate deploy && pnpm docker:dev"]
depends_on:
database:
condition: service_healthy
restart: always
api-test:
container_name: api-test
<<: *base-api
ports:
- "3334:3334"
env_file:
- ./.env.test
command: ["sh", "-c", "pnpm prisma migrate deploy && pnpm docker:dev & sleep 3 && pnpm docker:test"]
depends_on:
database-test:
condition: service_healthy
restart: always
database:
container_name: postgres
image: postgres:16
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- 5432:5432
env_file:
- ./.env
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 10s
retries: 10
database-test:
container_name: postgres-test
image: postgres:16
ports:
- 5433:5432
env_file:
- ./.env.test
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 10s
retries: 10
volumes:
postgres_data: