-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
79 lines (75 loc) · 2.22 KB
/
docker-compose.yml
File metadata and controls
79 lines (75 loc) · 2.22 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
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: mssql-infra
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=YourStrong!Passw0rd
- MSSQL_PID=Express
ports:
- "1433:1433"
volumes:
- mssql_data:/var/opt/mssql
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P YourStrong!Passw0rd -Q 'SELECT 1' -C"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
mssql-init:
image: mcr.microsoft.com/mssql/server:2022-latest
depends_on:
mssql:
condition: service_healthy
environment:
- SA_PASSWORD=YourStrong!Passw0rd
volumes:
- ./mssql/northwind.sql:/tmp/northwind.sql:ro
command: >
bash -c "
echo 'Waiting for SQL Server to be ready...' &&
sleep 10 &&
echo 'Creating northwind database...' &&
/opt/mssql-tools18/bin/sqlcmd -S mssql -U sa -P $$SA_PASSWORD -Q 'CREATE DATABASE northwind;' -C &&
echo 'Loading northwind.sql data...' &&
/opt/mssql-tools18/bin/sqlcmd -S mssql -U sa -P $$SA_PASSWORD -d northwind -i /tmp/northwind.sql -C &&
echo 'Northwind database setup completed successfully!'
"
postgres:
image: postgres:16-alpine
container_name: pgsql-infra
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=YourStrong!Passw0rd
- POSTGRES_DB=postgres
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
mysql:
image: mysql:8.0
container_name: mysql-infra
environment:
- MYSQL_ROOT_PASSWORD=YourStrong!Passw0rd
- MYSQL_DATABASE=northwind
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pYourStrong!Passw0rd"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
command: --default-authentication-plugin=mysql_native_password --lower-case-table-names=1
volumes:
mssql_data:
postgres_data:
mysql_data: