Commit 1ed5a7e7 authored by Christopher Harm's avatar Christopher Harm

Fixing docker context when building in subfolders

parent 2a771ea4
Pipeline #29356 passed with stages
in 38 seconds
......@@ -16,7 +16,9 @@ package cmd
import (
"errors"
"fmt"
"os"
"strings"
"git.psu.edu/k8s/devtool/config"
"git.psu.edu/k8s/devtool/environment"
......@@ -120,8 +122,14 @@ func buildDockerAndDeploy(config config.Config) error {
dockerTag := image + ":" + tag.String()
dockerRootDir := "."
if idx := strings.LastIndex(dockerfile, "/"); idx != -1 {
dockerRootDir = dockerfile[:idx]
fmt.Println(dockerRootDir)
}
color.New(color.FgGreen).PrintFunc()("Building ", dockerTag)
err = environment.Run(true, "docker", "build", "-t", dockerTag, "-f", dockerfile, ".")
err = environment.Run(true, "docker", "build", "-t", dockerTag, "-f", dockerfile, dockerRootDir)
if err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment