11 Building and testing applications with Docker and Docker Compose

 

Automation is at the heart of Docker. You describe the steps to package your component in a Dockerfile and use the Docker command line to execute them; you model the architecture of your app in a Docker Compose file and use the command line to start and stop the app. Command-line tools fit very neatly with automated processes, such as jobs running on a daily schedule or developers pushing code changes. It doesn’t matter which tool you’re using to run those jobs; they all let you run scripted commands so you can easily integrate the Docker workflow with your automation server.

Now you’re going to learn how to use continuous integration (CI) with Docker. CI is an automated process that runs regularly to build applications and execute a suite of tests. When the CI job is healthy, it means the latest code for the app is good, has been packaged, and is ready to deploy as a release candidate. Organizations typically use a CI service in the cloud, such as GitLab CI/CD or GitHub Actions, but you can easily run an equivalent stack locally in Docker, which is a useful backup option.

11.1 How the CI process works with Docker

11.2 Spinning up build infrastructure with Docker

11.3 Capturing build settings with Docker Compose

11.4 Writing CI jobs with no dependencies except Docker

11.5 Understanding containers in the CI process

11.6 Lab