Last active
March 14, 2022 14:07
-
-
Save bic742/97ef3359aff17a683d26c887318b177d to your computer and use it in GitHub Desktop.
Simple example of an MSSQL image, with multiple executions of the mssql-init to initialize and add modules to sql.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "2.4" | |
services: | |
mssql: | |
isolation: ${ISOLATION} | |
image: ${SITECORE_DOCKER_REGISTRY}nonproduction/mssql-developer:2017-${SITECORE_VERSION} | |
environment: | |
SA_PASSWORD: ${SQL_SA_PASSWORD} | |
ACCEPT_EULA: "Y" | |
ports: | |
- "14330:1433" | |
volumes: | |
- type: bind | |
source: .\mssql-data | |
target: c:\data | |
mssql-init: | |
isolation: ${ISOLATION} | |
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xm1-mssql-init:${SITECORE_VERSION} | |
environment: | |
SQL_SERVER: ${SQL_SERVER} | |
SQL_ADMIN_LOGIN: ${SQL_SA_LOGIN} | |
SQL_ADMIN_PASSWORD: ${SQL_SA_PASSWORD} | |
SITECORE_ADMIN_PASSWORD: ${SITECORE_ADMIN_PASSWORD} | |
POST_DEPLOYMENT_WAIT_PERIOD: 300 | |
healthcheck: | |
test: ["CMD", "powershell", "-command", "if ([System.Environment]::GetEnvironmentVariable('DatabasesDeploymentStatus', 'Machine') -eq 'Complete') { exit 0 } else { exit 1}"] | |
start_period: 300s | |
interval: 5s | |
depends_on: | |
mssql: | |
condition: service_healthy | |
mssql-init-spe: | |
isolation: ${ISOLATION} | |
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xm1-mssql-init:${VERSION:-latest} | |
build: | |
context: ./build/mssql-init | |
args: | |
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xm1-mssql-init:${SITECORE_VERSION} | |
SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-spe-assets:${SPE_VERSION} | |
HEADLESS_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-headless-services-xm1-assets:${HEADLESS_VERSION} | |
environment: | |
SQL_SERVER: ${SQL_SERVER} | |
SQL_ADMIN_LOGIN: ${SQL_SA_LOGIN} | |
SQL_ADMIN_PASSWORD: ${SQL_SA_PASSWORD} | |
SITECORE_ADMIN_PASSWORD: ${SITECORE_ADMIN_PASSWORD} | |
POST_DEPLOYMENT_WAIT_PERIOD: 300 | |
DATABASES_TO_DEPLOY: spe_data,headless_data | |
healthcheck: | |
test: ["CMD", "powershell", "-command", "if ([System.Environment]::GetEnvironmentVariable('DatabasesDeploymentStatus', 'Machine') -eq 'Complete') { exit 0 } else { exit 1}"] | |
start_period: 300s | |
interval: 5s | |
depends_on: | |
mssql: | |
condition: service_healthy | |
mssql-init: | |
condition: service_stopped | |
Thanks for the note, Rafael. I have updated the gist :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Aaron, your example is fantastic, it really helped when I got stuck trying to install multiple modules with one mssql-init image only.
However, if you allow me to make a small correction, in this part here:
DATABASES_TO_DEPLOY: spe_data, headless_data
You shouldn't have any spaces between the commas, because the script will do the following:
$DatabasesToDeploy.Split(',') | ForEach-Object {
which means if you have any spaces, this space will be included in the folder name, therefore throwing an error saying that the folder doesn't exist.
To be short, it should be like this:
DATABASES_TO_DEPLOY: spe_data,headless_data
Thank you for your post and for this Gist!