-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose.yml
63 lines (59 loc) · 1.9 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
version: '3.9'
services:
db:
container_name: postgres
image: postgres:latest
restart: unless-stopped
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DATABASE}
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data/pgdata
networks:
- token-backend
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres_user -d postgres_db" ]
interval: 30s
timeout: 10s
retries: 5
tty: true
stdin_open: true
redis:
container_name: redis
image: redis:latest
restart: unless-stopped
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- "6380:6379"
command: >
sh -c '
mkdir -p /usr/local/etc/redis &&
echo "bind 0.0.0.0" > /usr/local/etc/redis/redis.conf &&
echo "requirepass $REDIS_PASSWORD" >> /usr/local/etc/redis/redis.conf &&
echo "appendonly yes" >> /usr/local/etc/redis/redis.conf &&
echo "appendfsync everysec" >> /usr/local/etc/redis/redis.conf &&
echo "user default on nopass ~* +@all" > /usr/local/etc/redis/users.acl &&
redis-server /usr/local/etc/redis/redis.conf --aclfile /usr/local/etc/redis/users.acl
'
volumes:
- redis_data:/data
networks:
- token-backend
healthcheck:
test: [ "CMD", "redis-cli", "-a", "$REDIS_PASSWORD", "ping" ]
interval: 30s
timeout: 10s
retries: 5
tty: true
stdin_open: true
volumes:
postgres_data:
driver: local
redis_data:
networks:
token-backend: