Testing release scripts with Git and database containers

Use the database clones and containers to test release scripts with production data. That guarantees that the release scripts will work in production at release time. Test both upgrade as well as rollback scripts using containers and clones.

First create the dockerfile as follows:

dockerfile
FROM mssql-2017

# This line sets up the image to deliver clones of the customer database to each container
SETUPCLONING FULL customers C:\windocks\dbbackups\customerdatafull.bak

# Lines below this are run at container create time
# If you want to get the scripts and run them at image build time then comment the ENV line below. Container create time scripts means the latest from the git repo are applied
ENV USE_DOCKERFILE_TO_CREATE_CONTAINER=1

# Clone the git repo into the container in a directory called scripts
RUN "C:\Program Files\Git\cmd\git.exe" clone https://github.com/WinDocks/git-db-scripts-runtime.git scripts

# Run the script on the database clone in the container
RUN scripts\addColumnAtCreate.sql

In a command line on the Windocks server:
docker build -t yourimagename path\to\directory\containing\dockerfile


In a command line on the Windocks server:
docker run -d yourimagename

This will deliver a container with a writeable database clone of the customers database and the script addColumnAtCreate.sql applied to the database

You may also create containers with the clones from the web application at ServerIp:/index.html or the file windocks\ui\index.html in Chrome or Firefox

You may also create containers with the REST API here


View logs of the scripts in the web application by clicking log next to your container / clone.