-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
132 lines (124 loc) · 2.94 KB
/
docker-compose.yml
File metadata and controls
132 lines (124 loc) · 2.94 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
version: "3.8"
services:
# Telegram Bot
bot:
build:
context: .
dockerfile: Dockerfile
container_name: dating_bot
env_file:
- .env
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
restart: unless-stopped
volumes:
- ./logs:/app/logs
- ./images:/app/images
networks:
- dating_network
command: python main.py
# FastAPI WebApp API
api:
build:
context: .
dockerfile: Dockerfile
container_name: dating_api
env_file:
- .env
ports:
- "${WEBAPP_PORT:-8080}:8080"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
restart: unless-stopped
volumes:
- ./logs:/app/logs
networks:
- dating_network
command: python run_api.py
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: dating_postgres
environment:
POSTGRES_DB: ${DB_NAME:-dating_bot}
POSTGRES_USER: ${DB_USER:-postgres}
POSTGRES_PASSWORD: ${DB_PASS:-postgres}
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=en_US.UTF-8"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "${DB_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- dating_network
restart: unless-stopped
# Redis for FSM and Cache
redis:
image: redis:7-alpine
container_name: dating_redis
command: redis-server --requirepass ${REDIS_PASS:-redis_password} --appendonly yes
volumes:
- redis_data:/data
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- dating_network
restart: unless-stopped
# PgAdmin for Database Management (Development only)
pgadmin:
image: dpage/pgadmin4:latest
container_name: dating_pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@admin.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: "False"
ports:
- "${PGADMIN_PORT:-5050}:80"
depends_on:
- postgres
networks:
- dating_network
restart: unless-stopped
profiles:
- dev
# Nginx Reverse Proxy (Production)
nginx:
image: nginx:alpine
container_name: dating_nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- api
networks:
- dating_network
restart: unless-stopped
profiles:
- prod
networks:
dating_network:
driver: bridge
volumes:
postgres_data:
driver: local
redis_data:
driver: local