@@ -15,18 +15,36 @@ func BuildImage(image string, handler string, functionName string, language stri
1515 case "node" , "python" , "ruby" , "csharp" :
1616 tempPath := createBuildTemplate (functionName , handler , language )
1717
18- fmt .Printf ("Building: %s with Docker . Please wait..\n " , image )
18+ fmt .Printf ("Building: %s with %s template . Please wait..\n " , image , language )
1919
2020 flagStr := buildFlagString (nocache , squash , os .Getenv ("http_proxy" ), os .Getenv ("https_proxy" ))
2121
2222 builder := strings .Split (fmt .Sprintf ("docker build %s-t %s ." , flagStr , image ), " " )
2323 fmt .Println (strings .Join (builder , " " ))
2424 ExecCommand (tempPath , builder )
25+ fmt .Printf ("Image: %s built.\n " , image )
26+
27+ break
28+ case "Dockerfile" , "dockerfile" :
29+ tempPath := handler
30+ if _ , err := os .Stat (handler ); err != nil {
31+ fmt .Printf ("Unable to build %s, %s is an invalid path\n " , image , handler )
32+ fmt .Printf ("Image: %s not built.\n " , image )
33+
34+ break
35+ }
36+ fmt .Printf ("Building: %s with Dockerfile. Please wait..\n " , image )
37+
38+ flagStr := buildFlagString (nocache , squash , os .Getenv ("http_proxy" ), os .Getenv ("https_proxy" ))
39+
40+ builder := strings .Split (fmt .Sprintf ("docker build %s-t %s ." , flagStr , image ), " " )
41+ fmt .Println (strings .Join (builder , " " ))
42+ ExecCommand (tempPath , builder )
43+ fmt .Printf ("Image: %s built.\n " , image )
44+
2545 default :
2646 log .Fatalf ("Language template: %s not supported. Build a custom Dockerfile instead." , language )
2747 }
28-
29- fmt .Printf ("Image: %s built.\n " , image )
3048}
3149
3250// createBuildTemplate creates temporary build folder to perform a Docker build with Node template
0 commit comments