-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
54 lines (50 loc) · 1.58 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
version: '3'
services:
djangoapp:
build: .
container_name: djangoapp
volumes:
- ./djangoapp:/var/djangoapp # <-- bind the application code
- ./static_volume:/var/static # <-- bind the static files
- ./media_volume:/var/media # <-- bind the media files
networks:
- nginx_network
- database1_network
nginx:
image: nginx:1.15
container_name: nginx
ports:
- 80:80
- 443:443 # <-- expose HTTPS port
volumes:
- ./nginx:/etc/nginx/conf.d
- ./logs/nginx:/var/log/nginx
- ./shiba:/usr/share/nginx/html
- ./media_volume:/var/media # <-- bind the media files again so Nginx can share volume
- ./ssl:/etc/nginx/ssl # <-- bind SSL certificate and key
depends_on: # <-- wait for djangoapp to be "ready" before starting this service
- djangoapp
environment: # <-- add these environment variables
- COUNTRY=US
- STATE=California
- CITY=San Francisco
- ORGANIZATION=usfca
- ORGANIZATIONAL_UNIT=CS
- COMMON_NAME=admin
- EMAIL=ison2@dons.usfca.edu
networks:
- nginx_network
database1: # <-- IMPORTANT: same name as in Djano settings.py, otherwise Django won't find the database!
image: postgres:11
container_name: database1
env_file: # <-- match values to Djano settings.py
- config/db/database1_env
networks:
- database1_network
volumes:
- ./postgres/data:/var/lib/postgresql/data # <-- bind the database to local directory
networks:
nginx_network:
driver: bridge
database1_network:
driver: bridge