-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
59 lines (55 loc) · 1.25 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
version: "3.8"
volumes:
database:
services:
database:
image: library/postgres:14-alpine
container_name: docker-django-database
restart: on-failure
env_file:
- env/database.env
expose:
- 5432
volumes:
- ./database/scripts:/docker-entrypoint-initdb.d
- database:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ] # TODO: find a way to dynamically get the username
interval: 10s
timeout: 5s
retries: 5
web:
build: .
image: docker-django-app
command:
- /bin/sh
- -c
- |
python manage.py compilemessages
python manage.py migrate
python manage.py collectstatic --noinput
bash runserver.sh
volumes:
- .:/code
expose:
- 8081
env_file:
- env/app.env
- env/database.env
depends_on:
database:
condition: service_healthy
links:
- database
nginx:
image: library/nginx:latest
container_name: docker-django-nginx
ports:
- "127.0.0.1:8081:8081"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf.d:/etc/nginx/conf.d
- ./static:/static
- ./media:/media
depends_on:
- web