-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
86 lines (80 loc) · 2.78 KB
/
Copy pathdocker-compose.yml
File metadata and controls
86 lines (80 loc) · 2.78 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
version: '3.8'
services:
# ── MySQL ─────────────────────────────────────────────────────────────────
mysql:
image: mysql:8.0
container_name: ewallet-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root}
MYSQL_DATABASE: ewallet_db
MYSQL_CHARACTER_SET_SERVER: utf8mb4
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost",
"-u", "root", "-p${DB_PASSWORD:-root}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- ewallet-net
# ── Redis ─────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: ewallet-redis
restart: unless-stopped
# WHY --requirepass: Redis with no password is accessible to any process
# on the network. Even in Docker, always set a password.
command: redis-server --requirepass ${REDIS_PASSWORD:-redispass}
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-redispass}", "ping"]
interval: 10s
timeout: 3s
retries: 3
networks:
- ewallet-net
# ── Application ───────────────────────────────────────────────────────────
app:
build: .
container_name: ewallet-app
restart: unless-stopped
ports:
- "8080:8080"
environment:
DB_URL: jdbc:mysql://mysql:3306/ewallet_db?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
DB_USERNAME: root
DB_PASSWORD: ${DB_PASSWORD:-root}
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-redispass}
JWT_SECRET: ${JWT_SECRET:-dGhpcyBpcyBhIHNlY3JldCBrZXkgZm9yIGp3dCB0b2tlbiBnZW5lcmF0aW9uIGluIGV3YWxsZXQ=}
JWT_EXPIRY_SECONDS: 86400
BASE_URL: ${BASE_URL:-http://localhost:8080}
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- ewallet-net
healthcheck:
test: ["CMD-SHELL",
"wget -qO- http://localhost:8080/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
volumes:
mysql_data:
redis_data:
networks:
ewallet-net:
driver: bridge