Docker Community Forums

Share and learn in the Docker community.

Docker Build rules -- changing the Dockerfile name

HI, I am writing build rules and wanting to change the Dockerfile name for a release.

I have a single git repo containing subfolders for different containerized software. I am using git tags to indicate a submitted change in one of the sub folders I want to build. With the tag, I am also including a version I may want to build, otherwise, it just builds latest. For instance, my git folder might have:


Which I can tag in git using:

git tag -f -a "canu-2.1.1" -m "docker hub test"

My build rule, based on tags is:
source type: Tags
source: /canu-([0-9]+)/
docker tag: {\1}
dockerfile location: Dockerfile.{\1}
build context: /canu

The only problem is the Dockerfile.{\1} seems to be literal, ie doesn’t reflect the regex.
Dockerfile not found at ./canu/Dockerfile.{\1}

Is there a way to get dynamically change the Dockerfile name via the regex?

I know how I can get around this using a set name like Dockerfile.current or something, but I would prefer to have it build from a name I have saved in GitHub.