Building the solution using Docker in Jenkins

The build steps use PowerShell, running simple scripts so that there's no dependency on more complex Jenkins plugins. There are plugins specific to Docker that wrap up several tasks, such as building images and pushing them to a registry, but I can do everything I need with basic PowerShell steps and the Docker CLI. The first step builds all the images:

cd .ch10ch10-nerd-dinner

docker image build -t dockeronwindows/ch10-nerd-dinner-db:2e `
-f .docker erd-dinner-dbDockerfile .
docker image build -t dockeronwindows/ch10-nerd-dinner-index-handler:2e `
-f .docker erd-dinner-index-handlerDockerfile .
docker image build -t dockeronwindows/ch10-nerd-dinner-save-handler:2e `
-f .docker erd-dinner-save-handlerDockerfile .
...

It would be much nicer to use docker-compose build with override files, but there's an outstanding issue with the Docker Compose CLI, which means it doesn't work correctly with named pipes inside a container. When this is resolved in a future release of Compose, the build steps will be simpler.

Docker Compose is open source, and you can check on the status of this issue on GitHub here: https://github.com/docker/compose/issues/5934.

Docker builds the images using multi-stage Dockerfiles, and each step of the build executes in a temporary Docker container. Jenkins itself is running in a container, and it has the Docker CLI available in the image. I haven't had to install Visual Studio on a build server, or even install the .NET Framework or the .NET Core SDKs. All the prerequisites are in Docker images, so the Jenkins build just needs the source code and Docker.

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

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