-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.staging.yml
56 lines (54 loc) · 1.76 KB
/
docker-compose.staging.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
version: '3.7'
services:
# removed db container because using AWS RDS rather than managing a Postgres container
web:
build:
context: ./app
dockerfile: Dockerfile.prod
image: 115646757360.dkr.ecr.us-east-2.amazonaws.com/django-ec2-web
command: gunicorn ubc_course_explorer.wsgi:application --bind 0.0.0.0:8000
volumes:
- static_volume:/home/app/web/staticfiles
# expose port 8000 internally to nginx-proxy
expose:
- 8000
env_file:
- ./.env.prod
# automatically builds reverse proxy configuration for running containers using virtual hosts for routing
nginx-proxy:
container_name: nginx-proxy
build: nginx
image: 115646757360.dkr.ecr.us-east-2.amazonaws.com/django-ec2-nginx-proxy
restart: always
ports:
- 443:443
- 80:80
volumes:
- static_volume:/home/app/web/staticfiles
- certs:/etc/nginx/certs
- html:/usr/share/nginx/html
- vhost:/etc/nginx/vhost.d
- /var/run/docker.sock:/tmp/docker.sock:ro
depends_on:
- web
# issues SSL certificates for each container proxied by nginx-proxy
nginx-proxy-letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
# use staging environment for higher rate limitations during development and testing
env_file:
- ./.env.staging.proxy-companion
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- certs:/etc/nginx/certs
- html:/usr/share/nginx/html
- vhost:/etc/nginx/vhost.d
depends_on:
- nginx-proxy
volumes:
static_volume:
# stores certificates, private keys, and ACME account keys
certs:
# write http-01 challenge files
html:
# requests for static files will be served from the static folder instead of being proxied to other containers
vhost: