-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
95 lines (88 loc) · 2.09 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
version: '3'
networks:
application:
driver: bridge
volumes:
local_postgres_data: {}
local_backend_data: {}
services:
service-database:
image: postgres:12.9
container_name: service-database
volumes:
- local_postgres_data:/var/lib/postgresql/data/
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: twitter-clone
POSTGRES_HOST: service-database
networks:
- application
ports:
- 5432:5432
restart: always
service-backend:
build:
context: .
dockerfile: ./compose/rest/Dockerfile
container_name: service-backend
volumes:
- local_backend_data:/usr/src:z
command:
- /usr/src/compose/rest/runserver
env_file:
- ./.envs/.django
- ./.envs/.postgres
environment:
PYTHONUNBUFFERED: 1
POSTGRES_DOCKER_HOST: service-database
REDIS_HOST: worker-redis
CELERY_BROKER_URL: redis://worker-redis:6379/0
CELERY_RESULT_BACKEND: redis://worker-redis:6379/0
networks:
- application
ports:
- 8000:8000
depends_on:
- service-database
- worker-redis
- worker-celery
restart: always
service-frontend:
build:
context: .
dockerfile: ./compose/web/Dockerfile
container_name: service-frontend
networks:
- application
ports:
- 8080:8080
depends_on:
- service-database
- service-backend
restart: unless-stopped
worker-redis:
image: redis:6
container_name: worker-redis
networks:
- application
restart: unless-stopped
worker-celery:
build:
context: .
dockerfile: ./compose/celery/Dockerfile
container_name: worker-celery
command: celery -A celeryapp.tasks worker -l info
env_file:
- ./.envs/.django
- ./.envs/.postgres
environment:
CELERY_TIMEZONE: UTC
CELERY_BROKER_URL: redis://worker-redis:6379/0
CELERY_RESULT_BACKEND: redis://worker-redis:6379/0
networks:
- application
depends_on:
- worker-redis
- service-database
restart: unless-stopped