-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathdocker-compose-mysql.yml
More file actions
43 lines (41 loc) · 1.19 KB
/
docker-compose-mysql.yml
File metadata and controls
43 lines (41 loc) · 1.19 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
services:
server:
build: .
ports:
- 8000:8000
volumes:
- ./dailynotes-volume:/app/config
environment:
API_SECRET_KEY: ${API_SECRET_KEY:-CHANGE_THIS_WITH_SECURE_PASSWORD}
DB_ENCRYPTION_KEY: ${DB_ENCRYPTION_KEY:-CHANGE_THIS_WITH_SECURE_PASSWORD}
DATABASE_URI: mysql+pymysql://dailynotes:dailynotes@mysql:3306/dailynotes?charset=utf8mb4
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: dailynotes
MYSQL_USER: dailynotes
MYSQL_PASSWORD: dailynotes
volumes:
- mysql-data:/var/lib/mysql
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# Uncomment to expose MySQL port for direct access
# ports:
# - 3306:3306
volumes:
mysql-data: