-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
93 lines (85 loc) · 1.88 KB
/
docker-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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
version: '3.8'
x-base: &backend-base
build: .
env_file:
- .env.dev
depends_on:
- db
- redis
volumes:
- ./app:/opt/app
x-base-celery: &backend-base-celery
build: .
env_file:
- .env.dev
depends_on:
- django
volumes:
- ./app:/opt/app
services:
db:
container_name: etutor-db
env_file:
- .env.dev
image: postgres:12.5-alpine
environment:
POSTGRES_HOST: ${POSTGRES_HOST:-db}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
POSTGRES_DB: ${POSTGRES_DB:-django_db}
POSTGRES_USER: ${POSTGRES_USER:-django_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-django_password}
ports:
- "5432:5432"
restart: unless-stopped
redis:
container_name: etutor-redis
image: redis:alpine3.16
env_file:
- .env.dev
ports:
- "6379:6379"
django:
<<: *backend-base
command:
- /bin/bash
- -c
- |
set -e
while ! nc -z db 5432; do
sleep 0.1
done
echo "Runserver starting"
python manage.py runserver --insecure 0.0.0.0:8000
container_name: etutor-django
ports:
- "8000:8000"
image: etutor-django
restart: unless-stopped
migrate:
<<: *backend-base
depends_on:
- django
command:
- /bin/bash
- -c
- |
set -e
while ! nc -z db 5432; do
sleep 0.1
done
echo "Running migrations"
python manage.py makemigrations app
python manage.py migrate
container_name: etutor-migrate
image: etutor-migrate
restart: 'no'
celery-worker:
<<: *backend-base-celery
restart: always
command: celery -A etutor worker -l info
container_name: etutor-celery-worker
celery-beat:
<<: *backend-base-celery
restart: always
command: celery -A etutor beat -l info
container_name: etutor-celery-beat