-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yml
70 lines (66 loc) · 1.68 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
version: "3"
services:
redis:
image: "redis:alpine"
container_name: redis
expose:
- "6379"
profiles:
- prod
- debug
nginx:
image: "nginx"
container_name: nginx
volumes:
- ./nginx.conf.template:/etc/nginx/templates/nginx.conf.template
- ./static:/var/www/html/static:ro
ports:
- "${NGINX_PORT}:80"
environment:
- WEB_DOMAIN
- DJANGO_PORT
command: >
sh -c "envsubst '$$WEB_DOMAIN $$DJANGO_PORT' < /etc/nginx/templates/nginx.conf.template > /etc/nginx/conf.d/default.conf &&
nginx -g 'daemon off;'"
profiles:
- prod
depends_on:
- django-prod
django-prod:
build:
context: .
container_name: django-prod
volumes:
- .:/app
expose:
- "${DJANGO_PORT}"
environment:
- DJANGO_PORT
command: >
sh -c "python3 /app/manage.py makemigrations accounts fabry_perot michelson &&
python3 /app/manage.py migrate &&
python3 /app/manage.py collectstatic --no-input &&
gunicorn -b :${DJANGO_PORT} interferometers.wsgi"
profiles:
- prod
depends_on:
- redis
django-debug:
build:
context: .
container_name: django-debug
volumes:
- .:/app
ports:
- "${DJANGO_PORT}:${DJANGO_PORT}"
environment:
- DJANGO_PORT
command: >
sh -c "python3 -m pip install -r /app/requirements.txt &&
python3 /app/manage.py makemigrations accounts fabry_perot michelson &&
python3 /app/manage.py migrate &&
python3 /app/manage.py runserver --noreload 0.0.0.0:${DJANGO_PORT}"
profiles:
- debug
depends_on:
- redis