Add --backend-args

Allow to add arguments to the backend build arguments

Fixes #146
This commit is contained in:
Ettore Di Giacinto
2021-02-22 13:48:26 +01:00
parent 57e19c61e7
commit 749a4cb615
6 changed files with 29 additions and 19 deletions

View File

@@ -44,18 +44,11 @@ func NewSimpleDockerBackend() compiler.CompilerBackend {
// TODO: Missing still: labels, and build args expansion
func (*SimpleDocker) BuildImage(opts compiler.CompilerBackendOptions) error {
name := opts.ImageName
path := opts.SourcePath
dockerfileName := opts.DockerFileName
context := opts.Context
if context == "" {
context = "."
}
buildarg := []string{"build", "-f", dockerfileName, "-t", name, context}
buildarg := genBuildCommand(opts)
Info(":whale2: Building image " + name)
cmd := exec.Command("docker", buildarg...)
cmd.Dir = path
cmd.Dir = opts.SourcePath
err := runCommand(cmd)
if err != nil {
return err