-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose-sqlserver-test.yml
More file actions
45 lines (43 loc) · 1.46 KB
/
docker-compose-sqlserver-test.yml
File metadata and controls
45 lines (43 loc) · 1.46 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
services:
# SQL Server Database for testing account provisioning and random password generation
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: baton-sqlserver-test
environment:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: YourStrong@Passw0rd
MSSQL_PID: Developer
ports:
- "1433:1433"
volumes:
- ./test/sqlserver-init.sql:/tmp/init.sql
- sqlserver_data:/var/opt/mssql
healthcheck:
test:
[
"CMD-SHELL",
"/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P YourStrong@Passw0rd -C -Q 'SELECT 1' || exit 1",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# Simple init container to set up the database after SQL Server is ready
sqlserver-init:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: baton-sqlserver-init
depends_on:
sqlserver:
condition: service_healthy
volumes:
- ./test/sqlserver-init.sql:/tmp/init.sql
command: >
/bin/bash -c "
echo 'Initializing SQL Server database...'
/opt/mssql-tools18/bin/sqlcmd -S sqlserver -U sa -P YourStrong@Passw0rd -C -Q 'CREATE DATABASE BatonTestDB'
echo 'Database created, running initialization script...'
/opt/mssql-tools18/bin/sqlcmd -S sqlserver -U sa -P YourStrong@Passw0rd -C -d BatonTestDB -i /tmp/init.sql
echo 'Database initialization complete!'
"
volumes:
sqlserver_data: