mirror of
https://github.com/mudler/luet.git
synced 2025-09-02 07:45:02 +00:00
Add PreBuild steps
They are executed when building the "builder" image, those are not accounted to the diffs when producing the final artifact
This commit is contained in:
@@ -45,4 +45,10 @@ type CompilationSpec interface {
|
||||
|
||||
GetImage() string
|
||||
SetImage(string)
|
||||
|
||||
SetOutputPath(string)
|
||||
GetOutputPath() string
|
||||
Rel(string) string
|
||||
|
||||
GetPreBuildSteps() []string
|
||||
}
|
||||
|
@@ -16,16 +16,20 @@
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
|
||||
pkg "github.com/mudler/luet/pkg/package"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type LuetCompilationSpec struct {
|
||||
Steps []string `json:"steps"` // Are run inside a container and the result layer diff is saved
|
||||
PreBuildSteps []string `json:"pre_steps"` // Are run inside the image which will be our builder
|
||||
Image string `json:"image"`
|
||||
Seed string `json:"seed"`
|
||||
Package pkg.Package `json:"-"`
|
||||
OutputPath string `json:"-"` // Where the build processfiles go
|
||||
}
|
||||
|
||||
func NewLuetCompilationSpec(b []byte, p pkg.Package) (CompilationSpec, error) {
|
||||
@@ -46,6 +50,10 @@ func (cs *LuetCompilationSpec) BuildSteps() []string {
|
||||
return cs.Steps
|
||||
}
|
||||
|
||||
func (cs *LuetCompilationSpec) GetPreBuildSteps() []string {
|
||||
return cs.PreBuildSteps
|
||||
}
|
||||
|
||||
func (cs *LuetCompilationSpec) GetSeedImage() string {
|
||||
return cs.Seed
|
||||
}
|
||||
@@ -69,6 +77,10 @@ FROM ` + cs.GetSeedImage() + `
|
||||
COPY . /luetbuild
|
||||
WORKDIR /luetbuild
|
||||
`
|
||||
for _, s := range cs.GetPreBuildSteps() {
|
||||
spec = spec + `
|
||||
RUN ` + s
|
||||
}
|
||||
return spec, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user