From 0816d5083b80cc7a982d6a0e0d01de5187ccf85d Mon Sep 17 00:00:00 2001 From: axtloss Date: Thu, 19 Dec 2024 09:05:51 +0100 Subject: [PATCH] feat [close #105]: Add property to decide wether to add includes per stage --- api/structs.go | 25 +++++++++++++------------ core/build.go | 8 +++++--- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/api/structs.go b/api/structs.go index 126e161..de0fbbd 100644 --- a/api/structs.go +++ b/api/structs.go @@ -29,18 +29,19 @@ type Recipe struct { // Configuration for a stage in the recipe type Stage struct { - Id string `json:"id"` - Base string `json:"base"` - Copy []Copy `json:"copy"` - Labels map[string]string `json:"labels"` - Env map[string]string `json:"env"` - Adds []Add `json:"adds"` - Args map[string]string `json:"args"` - Runs Run `json:"runs"` - Expose map[string]string `json:"expose"` - Cmd Cmd `json:"cmd"` - Modules []interface{} `json:"modules"` - Entrypoint Entrypoint + Id string `json:"id"` + Base string `json:"base"` + Copy []Copy `json:"copy"` + Addincludes bool `json:"addincludes"` + Labels map[string]string `json:"labels"` + Env map[string]string `json:"env"` + Adds []Add `json:"adds"` + Args map[string]string `json:"args"` + Runs Run `json:"runs"` + Expose map[string]string `json:"expose"` + Cmd Cmd `json:"cmd"` + Modules []interface{} `json:"modules"` + Entrypoint Entrypoint } type PluginType int diff --git a/core/build.go b/core/build.go index 7b1ad2d..89a7ab4 100644 --- a/core/build.go +++ b/core/build.go @@ -231,9 +231,11 @@ func BuildContainerfile(recipe *api.Recipe) error { } // INCLUDES.CONTAINER - _, err = containerfile.WriteString(fmt.Sprintf("ADD %s /\n", recipe.IncludesPath)) - if err != nil { - return err + if stage.Addincludes { + _, err = containerfile.WriteString(fmt.Sprintf("ADD %s /\n", recipe.IncludesPath)) + if err != nil { + return err + } } for _, cmd := range cmds {