mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 08:14:46 +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
|
GetImage() string
|
||||||
SetImage(string)
|
SetImage(string)
|
||||||
|
|
||||||
|
SetOutputPath(string)
|
||||||
|
GetOutputPath() string
|
||||||
|
Rel(string) string
|
||||||
|
|
||||||
|
GetPreBuildSteps() []string
|
||||||
}
|
}
|
||||||
|
@@ -16,16 +16,20 @@
|
|||||||
package compiler
|
package compiler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
pkg "github.com/mudler/luet/pkg/package"
|
pkg "github.com/mudler/luet/pkg/package"
|
||||||
yaml "gopkg.in/yaml.v2"
|
yaml "gopkg.in/yaml.v2"
|
||||||
"io/ioutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type LuetCompilationSpec struct {
|
type LuetCompilationSpec struct {
|
||||||
Steps []string `json:"steps"` // Are run inside a container and the result layer diff is saved
|
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"`
|
Image string `json:"image"`
|
||||||
Seed string `json:"seed"`
|
Seed string `json:"seed"`
|
||||||
Package pkg.Package `json:"-"`
|
Package pkg.Package `json:"-"`
|
||||||
|
OutputPath string `json:"-"` // Where the build processfiles go
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLuetCompilationSpec(b []byte, p pkg.Package) (CompilationSpec, error) {
|
func NewLuetCompilationSpec(b []byte, p pkg.Package) (CompilationSpec, error) {
|
||||||
@@ -46,6 +50,10 @@ func (cs *LuetCompilationSpec) BuildSteps() []string {
|
|||||||
return cs.Steps
|
return cs.Steps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cs *LuetCompilationSpec) GetPreBuildSteps() []string {
|
||||||
|
return cs.PreBuildSteps
|
||||||
|
}
|
||||||
|
|
||||||
func (cs *LuetCompilationSpec) GetSeedImage() string {
|
func (cs *LuetCompilationSpec) GetSeedImage() string {
|
||||||
return cs.Seed
|
return cs.Seed
|
||||||
}
|
}
|
||||||
@@ -69,6 +77,10 @@ FROM ` + cs.GetSeedImage() + `
|
|||||||
COPY . /luetbuild
|
COPY . /luetbuild
|
||||||
WORKDIR /luetbuild
|
WORKDIR /luetbuild
|
||||||
`
|
`
|
||||||
|
for _, s := range cs.GetPreBuildSteps() {
|
||||||
|
spec = spec + `
|
||||||
|
RUN ` + s
|
||||||
|
}
|
||||||
return spec, nil
|
return spec, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user