I will start with the easiest part, which, in my opinion, is a common misconception:
Ideally, I can pass environment variables to the docker assembly, but this is not possible (I cannot understand why).
The docker design must be reproducible. Given the same context (files in the same directory as the Dockerfile ), the resulting image will be the same. They should also be simple. Both things together explain the lack of environmental options or other conditions.
Now, since the assembly must be reproducible, the execution of each command is cached. If you run the build twice, git pull will only work for the first time.
In your opinion, this is not what you intend:
therefore, with any new assembly of images, we always want the new version of the repo
To start a new build you need to either change the context or the Dockerfile .
The canonical path (I probably abuse this word, but here's how auto-build works) includes a Dockerfile in git.
This allows a simple git pull ; docker build ... workflow git pull ; docker build ... git pull ; docker build ... and avoids the problem of saving git credentials.
source share