I have a project in scala that takes a long time to build the docker image. The integration I have is Github -> CircleCI on commit. If I update only the integration tests written in python, I don’t want it to trigger the docker build step and instead fetch the last built image for the branch. How can this be achieved?
One approach is to split the image build into a base image and a code image. Do a base image build first (e.g. operating system and stuff that does not relate to the code base). Then push this image to a Docker registry. You could rebuild this weekly, on a schedule, so as to get the updates you want.
Finally in your second image, which responds to your code changes, inherit from the first image. That will shave off the first stage build time, since it is usually quicker to pull an image than it is to build it.