I am building a Docker image with AWS Codebuild. I recently added buildkit to make use of the build cache (before this, there was no cache utilized at all). The build command from my buildspec file is this:
DOCKER_BUILDKIT=1 docker build --build-arg BUILDKIT_INLINE_CACHE=1 [...a lot of build-args] -t $REPOSITORY_URI:latest --cache-from $REPOSITORY_URI:latest .
If I trigger a rebuild of the whole Codepipeline with no changes to the code from last build, it is using cache for most layers. Which I see by investigating build logs and finding lines like this #35 CACHED. But if I make any change to the code before building, all cache seems to have been invalidated. I expected that only the layers affected by the change, and those after, would have to be rebuild.
I would like some suggestion on how to solve this.