[Opinion]Best practice of tag build order in a repository

Hello,
I have a general problem, I mainly create an abstract Tag which I will refer to as “base”. After this I create variations of this Tag “configuration”, they are using the “base” in FROM statement. From my point of view, its seems good that base and configurations are in one repository in the same branch, because the configuration is most of the time only FROM + ENV + CMD.

How this looks like?

  • /configuration/config1/Dockerfile [Tag: config1]
  • /configuration/config2/Dockerfile [Tag: config2]
  • /Dockerfile [Tag: base]

The primary problem is, that it seems random in which order docker build this images. Yes its the same order as in repository managment but this order jumps around… So a build order like config2, base, config1 would be possible and config2 did not get the bug fix like config1. One Solution would be to create separate repository for base, in some situations better, but I don’t think in every case. So I tried to play a little bit with automated build hooks.

  • /configuration/config1/Dockerfile [Tag: config1]
  • /configuration/config2/Dockerfile [Tag: config2]
  • /Dockerfile [Tag: base]
  • /hooks/pre_push [post_push seems like after webhook]
#!/bin/sh

# push every config
cd configuration
for config in *
do
	docker build -t "$DOCKER_REPO:$config" "$config/."
	docker push "$DOCKER_REPO:$config"
done

From my current perspective, it looks fine. And…

  • I don’t need to create/manage a new build rule in docker, just a simple push
  • build log isn’t spammed for every config
  • still automated build
  • In Hub the visible Dockerfile is always base, not a config one.

Questions:

  1. What would be the normal way?
  2. Do you think/know this will be problematic in setup x?