Docker-compose using multiple dockerfiles with golang projects

I’m running in to an issue where I’m not able to run containers for multiple dockerfiles in the same project. Major points:

I’d like to use more than one Dockerfile to create multiple types of containers.
This is a golang project in which several independent apps or processes are held in the same repository.
I can only have one Dockerfile in the root of my application if I’m to use that as the build context.
If I try to put Dockerfiles in subfolders, I can’t build because there’s no .git folder.

Trying to determine the best approach. If I break this project up in to multiple repositories, there are going to be a lot of really tiny repos and there’s some common code shared amongst them.

Ideally if I could have multiple Dockerfiles in my root folder with different names that would also break the logjam.

I use to make a docker-compose.yml for this kind of use case. Then under a build dir I create a new dir for each Dockerfile I need. In that way you can indicate the diferent build dirs in your docker-compose using build configuration option like:

build: build/jenkins

Take a look at
You can build, run all images or specific ones as you need.