Skip to content

Commit

Permalink
Merge pull request #15074 from ComradeProgrammer/fix_15007
Browse files Browse the repository at this point in the history
fix: handle DOS-style path for Dockerfile in minikube build
  • Loading branch information
spowelljr authored Jun 12, 2023
2 parents 7032e51 + 0bb29fe commit 18ff76a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/minikube/cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/image"
"k8s.io/minikube/pkg/minikube/machine"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
docker "k8s.io/minikube/third_party/go-dockerclient"
)
Expand Down Expand Up @@ -310,6 +311,12 @@ var buildImageCmd = &cobra.Command{
// Otherwise, assume it's a tar
}
}
if runtime.GOOS == "windows" && strings.Contains(dockerFile, "\\") {
// if dockerFile is a DOS path, translate it into UNIX path
// because we are going to build this image in UNIX environment
out.String("minikube detects that you are using DOS-style path %s. minikube will convert it to UNIX-style by replacing all \\ to /", dockerFile)
dockerFile = strings.ReplaceAll(dockerFile, "\\", "/")
}
if err := machine.BuildImage(img, dockerFile, tag, push, buildEnv, buildOpt, []*config.Profile{profile}, allNodes, nodeName); err != nil {
exit.Error(reason.GuestImageBuild, "Failed to build image", err)
}
Expand Down

0 comments on commit 18ff76a

Please sign in to comment.