mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 16:25:19 +00:00
Define a build context for backends
This commit is contained in:
@@ -46,8 +46,12 @@ func (*SimpleDocker) BuildImage(opts compiler.CompilerBackendOptions) error {
|
|||||||
name := opts.ImageName
|
name := opts.ImageName
|
||||||
path := opts.SourcePath
|
path := opts.SourcePath
|
||||||
dockerfileName := opts.DockerFileName
|
dockerfileName := opts.DockerFileName
|
||||||
|
context := opts.Context
|
||||||
|
|
||||||
buildarg := []string{"build", "-f", dockerfileName, "-t", name, "."}
|
if context == "" {
|
||||||
|
context = "."
|
||||||
|
}
|
||||||
|
buildarg := []string{"build", "-f", dockerfileName, "-t", name, context}
|
||||||
|
|
||||||
Debug(":whale2: Building image " + name)
|
Debug(":whale2: Building image " + name)
|
||||||
cmd := exec.Command("docker", buildarg...)
|
cmd := exec.Command("docker", buildarg...)
|
||||||
|
@@ -35,9 +35,14 @@ func NewSimpleImgBackend() compiler.CompilerBackend {
|
|||||||
func (*SimpleImg) BuildImage(opts compiler.CompilerBackendOptions) error {
|
func (*SimpleImg) BuildImage(opts compiler.CompilerBackendOptions) error {
|
||||||
name := opts.ImageName
|
name := opts.ImageName
|
||||||
path := opts.SourcePath
|
path := opts.SourcePath
|
||||||
|
context := opts.Context
|
||||||
|
|
||||||
|
if context == "" {
|
||||||
|
context = "."
|
||||||
|
}
|
||||||
dockerfileName := opts.DockerFileName
|
dockerfileName := opts.DockerFileName
|
||||||
|
|
||||||
buildarg := []string{"build", "-f", dockerfileName, "-t", name, "."}
|
buildarg := []string{"build", "-f", dockerfileName, "-t", name, context}
|
||||||
Spinner(22)
|
Spinner(22)
|
||||||
defer SpinnerStop()
|
defer SpinnerStop()
|
||||||
Debug(":tea: Building image " + name)
|
Debug(":tea: Building image " + name)
|
||||||
|
@@ -42,6 +42,7 @@ type CompilerBackendOptions struct {
|
|||||||
SourcePath string
|
SourcePath string
|
||||||
DockerFileName string
|
DockerFileName string
|
||||||
Destination string
|
Destination string
|
||||||
|
Context string
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompilerOptions struct {
|
type CompilerOptions struct {
|
||||||
|
Reference in New Issue
Block a user