11.SUFFIXES :
22
3+ # Use bash if available, otherwise fall back to default shell
4+ SHELL := $(shell which bash 2>/dev/null || echo /bin/sh)
5+
36# Find all directories containing metadata.hcl
47FILES := $(shell find . -type f -name metadata.hcl)
58DIRS := $(patsubst % /,% ,$(patsubst ./% ,% ,$(dir $(FILES ) ) ) )
69
7- .PHONY : all clean check prereqs $(DIRS )
10+ .PHONY : all check prereqs push $(DIRS )
811
912# Colours
1013GREEN := \033[0;32m
@@ -15,6 +18,8 @@ NC := \033[0m
1518# Dry run flag
1619DRY_RUN ?= false
1720
21+ default : all
22+
1823# --------------------------
1924# Prerequisite checks
2025# --------------------------
@@ -41,14 +46,7 @@ check: prereqs
4146# --------------------------
4247push : all
4348 @echo -e " $( BLUE) Performing bake --push for all projects...$( NC) "
44- @$(foreach dir,$(DIRS ) , \
45- echo -e " $( BLUE) [PUSH] $dir $( NC) " ; \
46- if [ " $( DRY_RUN) " = " true" ]; then \
47- echo -e " $( GREEN) [DRY RUN] docker buildx bake -f $( dir) /metadata.hcl -f docker-bake.hcl --push$( NC) " ; \
48- else \
49- docker buildx bake -f $(dir ) /metadata.hcl -f docker-bake.hcl --push; \
50- fi ; \
51- )
49+ @$(foreach dir,$(DIRS ) , $(MAKE ) push-$(dir ) DRY_RUN=$(DRY_RUN ) ;)
5250
5351# --------------------------
5452# Generic per-project push
0 commit comments