-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathdocker-compose.yml
86 lines (80 loc) · 1.75 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
networks:
bootcamp:
volumes:
postgresdb:
services:
db:
image: postgres:12.0-alpine
ports:
- 5432:5432
volumes:
- postgresdb:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
environment:
PGUSER: bootcamp
POSTGRES_USER: bootcamp
POSTGRES_PASSWORD: bootcamp
POSTGRES_DB: bootcamp
networks:
- bootcamp
api:
restart: always
build:
dockerfile: Dockerfile
context: .
args:
API_PORT: ${API_PORT-8000}
ports:
- ${API_PORT-8000}:${API_PORT-8000}
volumes:
- ./swagger:/swagger
- ./cart_api:/cart_api
- ./diagrams:/diagrams
environment:
API_PORT: ${API_PORT-8000}
POSTGRES_USER: bootcamp
POSTGRES_PASSWORD: bootcamp
POSTGRES_DB: bootcamp
POSTGRES_HOST: db
API_CLEAR_DB: ${API_CLEAR_DB}
healthcheck:
test:
[
"CMD",
"curl",
"-f",
"http://localhost:${API_PORT-8000}/heartbeat"
]
interval: 30s
timeout: 10s
retries: 3
networks:
- bootcamp
depends_on:
db:
condition: service_healthy
tests:
restart: always
build:
dockerfile: Dockerfile
context: .
volumes:
- ./:/cart_api
environment:
API_PORT: ${API_PORT-8000}
POSTGRES_USER: bootcamp
POSTGRES_PASSWORD: bootcamp
POSTGRES_DB: bootcamp
POSTGRES_HOST: db
API_HOST: api
command: > # another way of defining commands
bash -c "coverage run --source cart_api -m pytest -rA /cart_api && coverage report -m"
depends_on:
api:
condition: service_healthy
networks:
- bootcamp