Open Barsonax opened 5 years ago
Images sizes for the mercury demo:
Could be done as follows (untested, powershell):
$InstallPath = "$env:INSTALL_PATH"
$DataPath = "$env:DATA_PATH"
$imagename = "project-mssql"
$containername = "sitecore-xp-mssql"
$baseimagename =sitecore-xp-mssql
$intermediateContainerName = "intermediate-" + $containername
docker create $baseimagename --name $intermediateContainername #create a new container based on the clean mssql container (contains no databases files)
docker cp $containername:$DataPath $intermediateContainername:$InstallPath #copy the database files to the temporary container
docker commit $intermediateContainername $imagename #commit the temporary container, overwritting the old image
#do some cleanup
So the idea is to copy the files to a temporary intermediate container that uses the base image and then commit that container under the required image name.
Currently everytime we persist the databases another copy of the databases is put into the docker image. This causes the image size to grow significantly.
Consider a multi stage approach where the database files are persisted in a clean mssql image.