-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompose.yaml
50 lines (47 loc) · 1.21 KB
/
compose.yaml
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
services:
server:
build:
context: .
restart: unless-stopped
command: python manage.py runserver 0.0.0.0:8000 # Only running the server here
ports:
- 8000:8000
environment:
SECRET_KEY: ${SECRET_KEY}
TIME_ZONE: ${TIME_ZONE}
DEBUG: ${DEBUG}
ALLOWED_HOSTS: ${ALLOWED_HOSTS}
INTERNAL_IPS: ${INTERNAL_IPS}
volumes:
- django-data:/srv/app
depends_on:
- migrate
- collectstatic
# Separate service for handling static files collection
collectstatic:
build:
context: .
command: python manage.py collectstatic --noinput
volumes:
- django-data:/srv/app
environment:
SECRET_KEY: ${SECRET_KEY}
TIME_ZONE: ${TIME_ZONE}
DEBUG: ${DEBUG}
ALLOWED_HOSTS: ${ALLOWED_HOSTS}
INTERNAL_IPS: ${INTERNAL_IPS}
# Separate service for handling migrations
migrate:
build:
context: .
command: python manage.py makemigrations && python manage.py migrate
volumes:
- django-data:/srv/app
environment:
SECRET_KEY: ${SECRET_KEY}
TIME_ZONE: ${TIME_ZONE}
DEBUG: ${DEBUG}
ALLOWED_HOSTS: ${ALLOWED_HOSTS}
INTERNAL_IPS: ${INTERNAL_IPS}
volumes:
django-data: