I’ve a Makefile with multiple git repo’s which I need to clone I use the following which works
clone:
git clone https://github.company.corp/dev-wi/ws-led.git
git clone https://github.company.corp/dev-wi/tools-extension.git
git clone https://github.company.corp/dev-wi/javt-ra.git
While the following code works, I want to do something like this in loop for all the repos on the list
build:
cd ws-led; \
docker build -t ws-led .
cd tools-extension; \
docker build -t tools-extension .
...
For each repo I need to change dir And run the docker build , I want to avoid doing this over and over again ... I know that I need to extract the string after /dev-wi/ as this is the repo directory which I need to run docker build on. since I’ve many repo how can I do it easily ?
I try with subset however I have also the git command (in clone) so it doesn't work,any idea?
update
I've created the A new makefile and use only this code (the ws-led
and tools-extension
is folders in the same level of of the makefile
repos := ws-led tools-extension
.PHONY: all
all: $(patsubst%,%/docker-build.log,$(repos))
%/docker-build.log: %/.git
cd $*; docker build -t $* . >&2 | tee docker-build.log
I got error:
make: Nothing to be done for
all'.`
what am I missing here ?
I try to simplify it but removing the git and let say that the folders (repo) existing on the same level of the makefile
UPDATE
Im change the makefile to be under the root
proj
- ws-led
— Dockerfile
-tools-ext
—Dockerfile
-Makefile
I try with the following
all: pre docker-build
.PHONY: pre docker-build
repos := ws-led tools-ext
pre:
$(patsubst %,%docker-build,$(repos))
docker-build:pre
cd $*; docker build -t $* . >&2 | tee docker-build
when I run make I got the following error
ws-leddocker-build ws-leddocker-build
make: ws-leddocker-build: No such file or directory
Any idea?