script

This section is where we run builds and tests:

docker build -t my-app .
docker run --rm --name app -dp 5000:5000 my-app
sleep 10
CODE=$(curl -IXGET -so /dev/null -w "%{http_code}" localhost:5000)
'[ ${CODE} -eq 200 ] && echo "Image is OK"'
docker stop app

As we're on Docker, the build only takes up one line of script. Our test is quite simple; it involves launching a container with the built image and making some requests to determine its integrity. We can do everything, including adding unit tests or running an automated integration test to improve the resultant artifacts, in this stage.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset