Refactor compiler and annotate buildoptions into compiler metadata

This allows to later pick up values used during build of each package
This commit is contained in:
Ettore Di Giacinto
2021-04-12 19:00:36 +02:00
parent 44cae094e8
commit 57c769b4a5
43 changed files with 1130 additions and 1235 deletions

View File

@@ -18,7 +18,6 @@ package backend
import (
"os/exec"
"github.com/mudler/luet/pkg/compiler"
"github.com/mudler/luet/pkg/config"
. "github.com/mudler/luet/pkg/logger"
@@ -36,16 +35,13 @@ func imageAvailable(image string) bool {
return err == nil
}
func NewBackend(s string) compiler.CompilerBackend {
var compilerBackend compiler.CompilerBackend
switch s {
case ImgBackend:
compilerBackend = NewSimpleImgBackend()
case DockerBackend:
compilerBackend = NewSimpleDockerBackend()
}
return compilerBackend
type Options struct {
ImageName string
SourcePath string
DockerFileName string
Destination string
Context string
BackendArgs []string
}
func runCommand(cmd *exec.Cmd) error {
@@ -75,7 +71,7 @@ func runCommand(cmd *exec.Cmd) error {
return nil
}
func genBuildCommand(opts compiler.CompilerBackendOptions) []string {
func genBuildCommand(opts Options) []string {
context := opts.Context
if context == "" {