-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
138 lines (131 loc) · 4.5 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
138 lines (131 loc) · 4.5 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
133
134
135
136
137
138
# ─── Development environment ────────────────────────────────────────────────
# Usage: make dev (or: docker-compose -f docker-compose.dev.yml up)
#
# Services:
# postgres — PostgreSQL 16
# redis — Redis 7
# minio — S3-compatible storage (console: http://localhost:9001)
# backend — FastAPI (hot-reload, debug port 5678)
# frontend — Next.js dev server (http://localhost:3000)
# bot — Telegram bot (aiogram3)
#
# Volumes:
# postgres_data — survives container restarts
services:
# ─── PostgreSQL ───────────────────────────────────────────────────────
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ecommerce
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
# ─── Redis ────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# ─── MinIO (S3-compatible storage) ────────────────────────────────────
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
# ─── Backend (FastAPI) ────────────────────────────────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8000:8000"
- "5678:5678" # debug / pdb
environment:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@postgres:5432/ecommerce
REDIS_URL: redis://redis:6379/0
CELERY_BROKER_URL: amqp://guest:guest@rabbitmq:5672//
CELERY_RESULT_BACKEND: redis://redis:6379/1
MINIO_ENDPOINT: minio:9000
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
MINIO_BUCKET: ecommerce
MINIO_SECURE: "false"
SECRET_KEY: dev-secret-key-change-in-production-min-32-chars!
DEBUG: "true"
ALLOWED_HOSTS: "*"
CORS_ORIGINS: '["http://localhost:3000"]'
TELEGRAM_BOT_ENABLED: "true"
volumes:
- ./backend/src:/app/src
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
# ─── Frontend (Next.js) ───────────────────────────────────────────────
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: builder
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_URL: http://localhost:8000
NEXT_PUBLIC_APP_NAME: E-Commerce
NEXT_PUBLIC_CURRENCY: UZS
NEXT_PUBLIC_LOCALE: uz-UZ
volumes:
- ./frontend/src:/app/src
- ./frontend/public:/app/public
- frontend_node_modules:/app/node_modules
depends_on:
- backend
# ─── Bot ──────────────────────────────────────────────────────────────
bot:
build:
context: ./bot
dockerfile: Dockerfile
environment:
BACKEND_API_URL: http://backend:8000
BOT_TOKEN: ""
TELEGRAM_AUTH_SECRET: ""
depends_on:
- backend
volumes:
postgres_data:
redis_data:
minio_data:
frontend_node_modules: