-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
65 lines (60 loc) · 1.64 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
x-logging: &default-logging
# Uncomment below to enable default logging
driver: json-file
# Uncomment below to enable Loki logging
# driver: loki
# options:
# loki-url: 'http://localhost:3100/api/prom/push'
# loki-pipeline-stages: |
# - multiline:
# firstline: '^\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2}'
# max_wait_time: 3s
# - regex:
# expression: '^(?P<time>\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2},d{3}) (?P<message>(?s:.*))$$'
services:
db:
image: postgres:16-alpine
env_file:
- .env
volumes:
- pg_data:/var/lib/postgresql/data
restart: unless-stopped
redis:
image: redis:latest
env_file:
- .env
restart: unless-stopped
# Set credentials & logging
command: >
sh -c '
mkdir -p /usr/local/etc/redis &&
echo "bind 0.0.0.0" > /usr/local/etc/redis/redis.conf &&
echo "appendonly yes" >> /usr/local/etc/redis/redis.conf &&
echo "user default on >$REDIS_PASSWORD ~* +@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:/var/lib/redis/data
fastapi:
build:
context: .
dockerfile: docker/fastapi.Dockerfile
target: dev
env_file:
- .env
restart: unless-stopped
ports:
- "8012:8000"
depends_on:
- db
- redis
logging: *default-logging
volumes:
- "./app:/opt/app/app"
- "./templates:/opt/app/templates"
- "./static:/opt/app/static"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
pg_data:
redis_data: