-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
74 lines (68 loc) · 1.59 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
version: "3.9"
services:
api:
build: .
image: branya/boiler_shop_api:4.0.0
container_name: api
volumes:
- static_volume:/opt/src/static
- media_volume:/opt/src/media
command: >
bash -c "
python manage.py makemigrations;
python manage.py migrate;
python manage.py createsuperuser --no-input;
python manage.py collectstatic --no-input;
gunicorn core.wsgi:application --workers "${GUNICORN_WORKERS:-2}" --bind 0.0.0.0:8000"
env_file:
- ./.env
depends_on:
db:
condition: service_healthy
healthcheck:
test: curl --fail -s http://localhost:8000/api/ || exit 1
interval: 30s
timeout: 10s
retries: 3
restart: always
db:
build: ./postgres
image: branya/boiler_shop_db:4.0.0
container_name: db
volumes:
- db_volume:/var/lib/postgresql/data/
env_file:
- ./.env
healthcheck:
test: ["CMD", "/usr/src/healthcheck.sh"]
interval: 30s
timeout: 2s
retries: 5
restart: always
nginx:
build: ./nginx
image: branya/boiler_shop_nginx:4.0.0
container_name: nginx
volumes:
- static_volume:/opt/src/static
- media_volume:/opt/src/media
ports:
- "80:80"
depends_on:
db:
condition: service_healthy
api:
condition: service_healthy
healthcheck:
test: ["CMD", "/usr/src/healthcheck.sh"]
interval: 30s
timeout: 5s
retries: 3
restart: always
volumes:
db_volume:
name: api_db
media_volume:
name: api_media
static_volume:
name: api_static