-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
101 lines (93 loc) · 2.67 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
96
97
98
99
100
101
name: timur # NOTE: Define COMPOSE_PROJECT_NAME in .env to use custom name
x-server: &base_server_setup
build:
context: ./backend/
# To attach to container with stdin `docker attach <container_name>`
# Used for python debugging.
stdin_open: true
tty: true
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:
- .env
environment:
APP_ENVIRONMENT: ${DJANGO_APP_ENVIRONMENT:-development}
APP_TYPE: web
DJANGO_DEBUG: ${DJANGO_DEBUG:-true}
ALLOW_DUMMY_DATA_SCRIPT: ${ALLOW_DUMMY_DATA_SCRIPT:-true}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY?error}
DJANGO_TIME_ZONE: ${DJANGO_TIME_ZONE:-Asia/Kathmandu}
# -- Domain configurations
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:-*}
APP_DOMAIN: localhost:8000
APP_HTTP_PROTOCOL: ${APP_HTTP_PROTOCOL:-http}
APP_FRONTEND_HOST: ${APP_FRONTEND_HOST:-http://localhost:3000}
SESSION_COOKIE_DOMAIN: ${SESSION_COOKIE_DOMAIN:-localhost}
CSRF_COOKIE_DOMAIN: ${CSRF_COOKIE_DOMAIN:-localhost}
# Database config
DB_HOST: ${DB_HOST:-db}
DB_PORT: ${DB_PORT:-5432}
DB_NAME: ${DB_NAME:-postgres}
DB_USER: ${DB_USER:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
# # Redis config
CELERY_REDIS_URL: ${CELERY_REDIS_URL:-redis://redis:6379/0}
DJANGO_CACHE_REDIS_URL: ${DJANGO_CACHE_REDIS_URL:-redis://redis:6379/1}
# Email config
EMAIL_FROM: ${EMAIL_FROM:-togglecorp-dev <[email protected]>}
volumes:
- ./backend/:/code
- backend_data:/data/
- ipython_data_local:/root/.ipython/profile_default # persist ipython data, including ipython history
depends_on:
- db
- redis
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- postgres-data15:/var/lib/postgresql/data
# ports:
# - 127.0.0.1:50432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:6-alpine
volumes:
- redis-data:/data
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 10s
timeout: 5s
retries: 5
web:
<<: *base_server_setup
command: bash -c 'wait-for-it $$DB_HOST:$$DB_PORT && ./manage.py runserver 0.0.0.0:8100'
ports:
- 127.0.0.1:8100:8100
react:
depends_on:
- web
build: .
command: sh -c 'pnpm install && pnpm start'
volumes:
- .:/code
ports:
- 127.0.0.1:3000:3000
volumes:
postgres-data15:
redis-data:
ipython_data_local:
backend_data: