diff --git a/Makefile b/Makefile index db6addb..cf1079e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2025-12-17T11:13:19Z by kres 4b09af7-dirty. +# Generated on 2025-12-31T09:29:35Z by kres 26be706-dirty. # common variables @@ -46,6 +46,7 @@ PLATFORM ?= linux/amd64 PROGRESS ?= auto PUSH ?= false CI_ARGS ?= +WITH_BUILD_DEBUG ?= BUILDKIT_MULTI_PLATFORM ?= COMMON_ARGS = --file=Dockerfile COMMON_ARGS += --provenance=false @@ -127,6 +128,10 @@ respectively. endef +ifneq (, $(filter $(WITH_BUILD_DEBUG), t true TRUE y yes 1)) +BUILD := BUILDX_EXPERIMENTAL=1 docker buildx debug --invoke /bin/sh --on error build +endif + ifneq (, $(filter $(WITH_RACE), t true TRUE y yes 1)) GO_BUILDFLAGS += -race CGO_ENABLED := 1 diff --git a/internal/project/common/docker.go b/internal/project/common/docker.go index 81ac8f8..5042456 100644 --- a/internal/project/common/docker.go +++ b/internal/project/common/docker.go @@ -139,9 +139,15 @@ func (docker *Docker) CompileMakefile(output *makefile.Output) error { Variable(makefile.OverridableVariable("PROGRESS", "auto")). Variable(makefile.OverridableVariable("PUSH", "false")). Variable(makefile.OverridableVariable("CI_ARGS", "")). + Variable(makefile.OverridableVariable("WITH_BUILD_DEBUG", "")). Variable(makefile.OverridableVariable("BUILDKIT_MULTI_PLATFORM", "")). Variable(buildArgs) + output.IfTrueCondition("WITH_BUILD_DEBUG"). + Then( + makefile.SimpleVariable("BUILD", "BUILDX_EXPERIMENTAL=1 docker buildx debug --invoke /bin/sh --on error build"), + ) + output.Target("target-%"). Description("Builds the specified target defined in the Dockerfile. The build result will only remain in the build cache."). Script(`@$(BUILD) --target=$* $(COMMON_ARGS) $(TARGET_ARGS) $(CI_ARGS) .`) diff --git a/internal/project/pkgfile/build.go b/internal/project/pkgfile/build.go index f278694..b9ac255 100644 --- a/internal/project/pkgfile/build.go +++ b/internal/project/pkgfile/build.go @@ -108,9 +108,15 @@ func (pkgfile *Build) CompileMakefile(output *makefile.Output) error { Variable(makefile.OverridableVariable("PROGRESS", "auto")). Variable(makefile.OverridableVariable("PUSH", "false")). Variable(makefile.OverridableVariable("CI_ARGS", "")). + Variable(makefile.OverridableVariable("WITH_BUILD_DEBUG", "")). Variable(buildArgs). Variable(commonArgs) + output.IfTrueCondition("WITH_BUILD_DEBUG"). + Then( + makefile.SimpleVariable("BUILD", "BUILDX_EXPERIMENTAL=1 docker buildx debug --invoke /bin/sh --on error build"), + ) + for _, arg := range pkgfile.Makefile.ExtraVariables { output.VariableGroup(makefile.VariableGroupExtra). Variable(makefile.OverridableVariable(arg.Name, arg.DefaultValue))