-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathdocker-compose.yml
76 lines (72 loc) · 1.97 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
services:
app:
container_name: kelvin_app
depends_on:
- db
- redis
profiles: [ prod ]
build:
context: .
dockerfile: Dockerfile
target: runtime
restart: unless-stopped
environment:
# Hardcode the DB and Redis hostnames and ports, since they necessarily
# run inside the same Docker network, as they are defined in this docker-compose.yml file.
- DATABASE__HOST=db
- DATABASE__PORT=5432
- REDIS__HOST=redis
- REDIS__PORT=6379
env_file:
- .env
volumes:
- app_static:/app/static
- app_socket:/socket
- ${KELVIN__LOCAL_SETTINGS_PATH}:/app/kelvin/local_settings.py:ro
- ${UWSGI__CONFIG_PATH}:/app/uwsgi.ini:ro
db:
container_name: kelvin_db
image: postgres:14
restart: unless-stopped
environment:
- POSTGRES_DB=${DATABASE__DB}
- POSTGRES_USER=${DATABASE__USERNAME}
- POSTGRES_PASSWORD=${DATABASE__PASSWORD}
env_file:
- .env
volumes:
- ${DATABASE__DATA_PATH}:/var/lib/postgresql/data
ports:
- "127.0.0.1:${DATABASE__PORT}:5432"
redis:
container_name: kelvin_redis
image: redis:7
restart: unless-stopped
env_file:
- .env
volumes:
- ${REDIS__DATA_PATH}:/data
ports:
- "127.0.0.1:${REDIS__PORT}:6379"
# Save Redis DB to disk at least once per 30 minutes
# Set maximum DB size to 1 GiB, evict all old keys
command: "redis-server --save 1800 1 300 100 60 1000 --maxmemory 1024mb --maxmemory-policy allkeys-lru --loglevel warning"
nginx:
image: nginx:1.26
container_name: kelvin_nginx
depends_on:
- app
restart: unless-stopped
profiles: [ prod ]
ports:
- "80:80"
- "443:443"
volumes:
- ${NGINX__CONFIG_PATH}:/etc/nginx/nginx.conf:ro
- ${NGINX__CERTS_PATH}:/etc/nginx/certs:ro
- ${NGINX__LOGS_PATH}:/var/log/nginx
- app_static:/app/static:ro
- app_socket:/socket
volumes:
app_static:
app_socket: