-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
53 lines (48 loc) · 1000 Bytes
/
docker-compose.yaml
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
version: "3.8"
services:
db:
image: postgres:latest
ports:
- "5432:5432"
environment:
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
restart: always
container_name: db
volumes:
- pg_data:/var/lib/postgresql/data/
env_file:
- .env_docker
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}" ]
interval: 5s
timeout: 5s
retries: 10
api:
build:
context: .
dockerfile: Dockerfile
restart: always
env_file: .env_docker
depends_on:
db:
condition: service_healthy
migrations:
condition: service_completed_successfully
ports:
- "8000:8000"
migrations:
build:
context: .
dockerfile: Dockerfile
depends_on:
db:
condition: service_healthy
env_file:
- .env_docker
command: >
sh -c "python ./manage.py migrate"
volumes:
pg_data:
django_static: