TDD is a software-development concept. Here we are demonstrating how some aspects of TDD can be adapted for use in Dockerfile development.
- This example demonstrates using some aspects of Test-Driven Development to develop an example Dockerfile.
- Each subdirectory here will give you a step-by-step understanding of how our Dockerized application evolves.
- We are creating a Dockerized version of a Spring-Boot Java app - petclinic.
- A binary JAR of this has already been compiled and uploaded here: spring-petclinic-1.5.1.jar
- A Linux system with the ability to run Ruby, Gems and Bundler is required.
- Docker
17.05-ce
or greater should be installed. - A basic knowledge of Ruby, Rubygems, Gemfiles and Bundler is advised.
- Understanding of the Docker API for Ruby is advised.
- First we create the stub files and folders necessary.
- See step-1 directory for details.
- Next, we flesh out the specs (or "behavior" if you will) of our Docker image.
- See step-2 directory for detail.
- Next we flesh out our Dockerfile so as to fulfil the specs.
- After incrementally filling out our
Dockerfile
we execute the spec each time. - See step-3 directory.
- Continue implementing the rest of the tests.
- Watch the tests fail, implement your
Dockerfile
and rerun the tests until they pass. - Refactor as necessary.
- See step-4 directory.
- Serverspec
- This gist
- Rspec: creating pending examples
- Guidelines for writing RSpec Tests
- The ServerSpec documentation
- Docker API for Ruby
- Existing articles on TDD and Docker: 1, 2, 3