Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider persisting the mssql databases in a clean mssql image (aka multi stage build) #123

Open
Barsonax opened this issue May 21, 2019 · 2 comments

Comments

@Barsonax
Copy link
Contributor

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.

@Barsonax
Copy link
Contributor Author

Images sizes for the mercury demo:
image

@Barsonax
Copy link
Contributor Author

Barsonax commented May 21, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant