-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
89 lines (81 loc) · 2.33 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
services:
postgres-db:
image: postgres:16.3
restart: always
container_name: postgres-db
ports:
- 5600:5432
environment:
POSTGRES_DB: ${POSTGRES_DB:-my_django}
POSTGRES_USER: ${POSTGRES_USER:-postgresuser}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgrespassword}
PGDATA: /var/lib/postgresql/data
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- app-network
redis:
image: redis:7.4.0-alpine
restart: always
container_name: redis
ports:
- 6379:6379
networks:
- app-network
web:
build: ./backend/
command: >
sh -c "
python manage.py makemigrations &&
python manage.py migrate &&
daphne -b 0.0.0.0 -p 8000 core.asgi:application
"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health/"]
interval: 30s
timeout: 10s
retries: 3
volumes:
- ./backend:/app
ports:
- "8000:8000"
# - "8899:8899"
depends_on:
- postgres-db
- redis
environment:
- DEBUG=${DEBUG:-True}
- SECRET_KEY=${SECRET_KEY:-django-insecure-e3-dfc5$67!z!scs=mex6xmq=5l@1u4g)ckajac+dhh)jl*91o}
- DJANGO_SETTINGS_MODULE=core.settings
- POSTGRES_DB=${POSTGRES_DB:-my_django}
- POSTGRES_USER=${POSTGRES_USER:-postgresuser}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgrespassword}
- POSTGRES_HOST=${POSTGRES_HOST:-postgres-db}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PORT=${REDIS_PORT:-6379}
# -REDIS_PASSWORD${...} # only for production environment
# 127.0.0.1
- ALLOWED_HOSTS=${ALLOWED_HOSTS:-*}
- CSRF_TRUSTED_ORIGINS=${CSRF_TRUSTED_ORIGINS:-http://localhost:8000,http://localhost:7777}
- CORS_ALLOW_ALL_ORIGINS=${CORS_ALLOW_ALL_ORIGINS:-True}
- ACCOUNT_EMAIL_VERIFICATION=${ACCOUNT_EMAIL_VERIFICATION:-none}
- EMAIL_BACKEND=${EMAIL_BACKEND:-django.core.mail.backends.console.EmailBackend}
networks:
- app-network
nginx:
image: nginx:1.27.0
restart: always
ports:
- "7777:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- web
networks:
- app-network
volumes:
postgres_data:
networks:
app-network:
driver: bridge