In the docker documentation one can see that it is possible to build an image from git repository. It is even possible to make a build from the selected branch and directory. I have a repository with multiple Dockerfiles in a directories structure. They are locally built though with the project root context, so I run:
docker build -f docker/backend/Dockerfile -t mybackend .
and thus I have image built with context of
/. But documentation on building from git says, this context is used only on repositories where Dockerfile is in the main project dir.
Is it possible to bypass this somehow? To run command:
docker build -t myimage firstname.lastname@example.org:user/repo.git#branch:docker/backend
and have it built with context of the main directory?