-
Notifications
You must be signed in to change notification settings - Fork 72
/
docker-compose.yml
77 lines (68 loc) · 1.88 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
# resources:
# http://www.ameyalokare.com/docker/2017/09/20/nginx-flask-postgres-docker-compose.html
# https://github.com/juggernaut/nginx-flask-postgres-docker-compose-example
# https://serverfault.com/questions/783806/docker-how-to-django-uwsgi-gunicorn-nginx/787402
# https://github.com/andrecp/django-tutorial-docker-nginx-postgres
# https://github.com/realpython/dockerizing-django
# http://ruddra.com/2016/08/14/docker-django-nginx-postgres/index.html
# https://stackoverflow.com/questions/32180589/docker-how-to-expose-a-socket-over-a-port-for-a-django-application
version: '3'
services:
# database containers, one for each db
database1:
image: postgres:10
volumes:
- database1_volume:/var/lib/postgresql/data
env_file:
- config/db/database1_env
networks:
- database1_network
database2:
image: postgres:10
volumes:
- database2_volume:/var/lib/postgresql/data
env_file:
- config/db/database2_env
networks:
- database2_network
# web container, with django + gunicorn
djangoapp:
build: .
environment:
- DJANGO_SETTINGS_MODULE
volumes:
- .:/opt/services/djangoapp/src
- static:/opt/services/djangoapp/static
- media:/opt/services/djangoapp/media
networks:
- database1_network
- database2_network
- nginx_network
depends_on:
- database1
- database2
# reverse proxy container (nginx)
nginx:
image: nginx:1.13
ports:
- 8000:80
volumes:
- ./config/nginx/conf.d:/etc/nginx/conf.d
- static:/opt/services/djangoapp/static
- media:/opt/services/djangoapp/media
networks:
- nginx_network
depends_on:
- djangoapp
networks:
database1_network:
driver: bridge
database2_network:
driver: bridge
nginx_network:
driver: bridge
volumes:
database1_volume:
database2_volume:
static:
media: