-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
64 lines (64 loc) · 2.18 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
64 lines (64 loc) · 2.18 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
---
services:
mysqld:
image: mysql:8.0-bookworm
restart: always
container_name: mysqld_c
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- ./data/mysql_data:/var/lib/mysql
- ./mysqld/init_db:/docker-entrypoint-initdb.d # Optional if you have init scripts
ports: [3306:3306]
healthcheck:
test:
- CMD
- mysqladmin
- ping
- -h
- localhost
- -u
- ${MYSQL_USER}
- -p${MYSQL_PASSWORD}
interval: 30s
timeout: 10s
retries: 10
start_period: 30s
mysql_client:
image: mysql:8.0-bookworm
container_name: mysql_client_c
depends_on:
mysqld:
condition: service_healthy
command: [sleep, infinity] # Keep alive for manual exec: docker exec -it mysql_client_c mysql -h mysqld_c -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE}
psqld:
image: postgres:17-trixie
restart: always
container_name: psqld_c
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
volumes:
- ./data/postgresql_data:/var/lib/postgresql/data
- ./psqld/init_db:/docker-entrypoint-initdb.d # Optional
ports: [5432:5432]
healthcheck:
test:
[CMD-SHELL, "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
psql_client:
image: postgres:17-trixie
container_name: psql_client_c
environment:
PGPASSWORD: ${POSTGRES_PASSWORD}
depends_on:
psqld:
condition: service_healthy
command: [sleep, infinity] # Manual exec: docker exec -it psql_client_c psql -h psqld_c -U ${POSTGRES_USER} -d ${POSTGRES_DB}