-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdocker-compose.yml
58 lines (53 loc) · 1.69 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
# Simple Dockerfile example that deploys our app server and a web server for static files
# using the traefik reverse proxy.
version: '3.1'
volumes:
# initialize nginx's static www files from the demoapp's `manage.py collectstatic`
staticfiles: {}
services:
traefik:
image: traefik
command: --api --docker
ports:
# only expose https to outside world
- "443:443" # SSL
- "8080:8080" # Traefik dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "$PWD/traefik/config/traefik.toml:/etc/traefik/traefik.toml"
- "$PWD/traefik/certs/:/certs/"
labels:
- "traefik.enable=true"
depends_on:
- demoapp
- nginx
demoapp:
image: myapp:latest
hostname: demoapp
extra_hosts:
# alias to host.docker.internal
- "oauth-dev.cuit.columbia.edu:192.168.65.2"
environment:
- DJANGO_DEBUG=false
- OAUTH2_SERVER=https://oauth-dev.cuit.columbia.edu:8443
labels:
- "traefik.frontend.rule=Host:localhost;PathPrefix:/v1"
- "traefik.port=9123"
ports:
- "9123:9123"
volumes:
- staticfiles:/var/www/html
depends_on:
- nginx
nginx:
image: nginx:latest
hostname: webserver
volumes:
- staticfiles:/usr/share/nginx/html/static
labels:
# look for /openapi/* and /oauth2-redirect.html
- "traefik.frontend.rule=Host:localhost;PathPrefix:/static,/openapi/,/oauth2-redirect.html"
- "traefik.port=80"
# If I try to mount staticfiles at /usr/share/nginx/html, nginx clobbers my files, so
# mount at .../static and then symlink
command: /bin/bash -c "cd /usr/share/nginx/html && ln -sf static/* . && exec nginx -g 'daemon off;'"