Let's say you have a ruby project. You write tests using rspec and you write documentation inside the code. And you are using awesome GitLab to host your git repo, run CI pipelines and store your docker images in registry.
First we need to build an image. But we want to leverage docker layer caching, because libraries (rubygems) doesn't update very often. That's why we do docker pull
first, and docker build --cache-from
after.
If you make a feature branch and update some libraries, you can't use layer with libraries form the master
branch. That's why we try to docker pull
for feature branch first, and docker pull
for master
branch after.