Docker Layer Caching by Branch

Is it possible to cache layers but only for the branch you are building for?

Say i build “docker build -t myacc/myapp:$CIRCLE_BRANCH .”

Is it possible to only cache for the tagged build? If not does it just cache general layers and only rebuild on some edited account of the dockerfile?

I ask this because I would like to cache per build branch, e.g. integration, master, dev branches.

I do layer caching a manual way, and I think per-branch caching would be possible with that. If that is of interest, see this post, and look at the ‘remote image cache’ approach. I dare say that could be modified to include a branch name env var in the cache images.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.