I have a docker-compose.yml file
services:
myservice:
build:
context: https://github.com/foo/bar.git#branch:folder
dockerfile: Dockerfile
...
when I execute docker compose build --no-cache
I get the output
=> CACHED [myservice internal] load git source https://github.com/foo/bar.git#branch:folder
It seems that it caches the git repo. I want docker to always pull the git repo so that my changes are applied when building. How can I do that?
It is caching the git repo, yes, and there isn't a compose option to change that.
However, based on the compose sources, the caching is done based on a git SHA.
ref.Commit = sha
...
local := filepath.Join(cache, ref.Commit)
So the content in the cache will really only be used when the repo has not changed on that branch you are fetching it from, since it's based on a checksum.
If the checksum does not match, it means that the cache is not up to date and compose will fetch the latest updates from your github repo, no matter what, and your latest changes will be applied.