-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
87 lines (82 loc) · 3.05 KB
/
Copy pathdocker-compose.yml
File metadata and controls
87 lines (82 loc) · 3.05 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
version: "3.9"
services:
# ── MySQL 8 ────────────────────────────────────────────────────────────────
mysql:
image: mysql:8.0
container_name: electronics-store-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-password}
MYSQL_DATABASE: electronics_store
MYSQL_USER: ${DB_USERNAME:-appuser}
MYSQL_PASSWORD: ${DB_PASSWORD:-password}
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
--default-time-zone=+00:00
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DB_PASSWORD:-password}"]
interval: 10s
timeout: 5s
retries: 10
# ── Redis ──────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: electronics-store-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ── App ────────────────────────────────────────────────────────────────────
app:
build:
context: .
dockerfile: Dockerfile
container_name: electronics-store-app
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
environment:
DB_URL: jdbc:mysql://mysql:3306/electronics_store?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
DB_USERNAME: ${DB_USERNAME:-appuser}
DB_PASSWORD: ${DB_PASSWORD:-password}
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRATION_MS: ${JWT_EXPIRATION_MS:-86400000}
JWT_REFRESH_MS: ${JWT_REFRESH_MS:-604800000}
MAIL_HOST: ${MAIL_HOST:-smtp.gmail.com}
MAIL_PORT: ${MAIL_PORT:-587}
MAIL_USERNAME: ${MAIL_USERNAME}
MAIL_PASSWORD: ${MAIL_PASSWORD}
PAYSTACK_SECRET_KEY: ${PAYSTACK_SECRET_KEY}
PAYSTACK_PUBLIC_KEY: ${PAYSTACK_PUBLIC_KEY}
PAYSTACK_WEBHOOK_SECRET: ${PAYSTACK_WEBHOOK_SECRET}
FLUTTERWAVE_SECRET_KEY: ${FLUTTERWAVE_SECRET_KEY}
FLUTTERWAVE_PUBLIC_KEY: ${FLUTTERWAVE_PUBLIC_KEY}
FLUTTERWAVE_WEBHOOK_SECRET: ${FLUTTERWAVE_WEBHOOK_SECRET}
FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000}
ports:
- "8080:8080"
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
volumes:
mysql_data:
redis_data: