Skip to content

Instantly share code, notes, and snippets.

@abdennour
Created October 2, 2024 21:06
Show Gist options
  • Save abdennour/9940b215324ca0508fd769c151ee5217 to your computer and use it in GitHub Desktop.
Save abdennour/9940b215324ca0508fd769c151ee5217 to your computer and use it in GitHub Desktop.
version: "3.7"
services:
db:
image: mcr.microsoft.com/mssql/server:2017-latest
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
env_file:
- .env
healthcheck:
test:
[
"CMD-SHELL",
"/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${DB_PASSWORD} -Q 'SELECT 1' || exit 1",
]
interval: 10s
retries: 10
start_period: 10s
timeout: 3s
db.configurator:
image: mcr.microsoft.com/mssql/server:2017-latest
env_file:
- .env
depends_on:
db:
condition: service_healthy
command: >
bash -c '
/opt/mssql-tools/bin/sqlcmd -S db -U sa -P ${DB_PASSWORD} -Q "CREATE DATABASE ${DB_NAME} COLLATE Arabic_CI_AS";
echo "All done!";
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment