@@ -75,8 +75,12 @@ func (m *manager) AddImage(imageName, image, projectNamespace, dockerfile string
7575 } else {
7676 if buildMethod != skip && buildMethod != rootLevelDockerfile {
7777 imageConfig .Dockerfile , err = m .log .Question (& survey.QuestionOptions {
78- Question : "Please enter the path to this Dockerfile" ,
78+ Question : "Please enter the path to this Dockerfile: (Enter to skip) " ,
7979 ValidationFunc : func (value string ) error {
80+ if value == "" {
81+ return nil
82+ }
83+
8084 stat , err := os .Stat (value )
8185 if err == nil && ! stat .IsDir () {
8286 return nil
@@ -88,24 +92,28 @@ func (m *manager) AddImage(imageName, image, projectNamespace, dockerfile string
8892 return err
8993 }
9094
91- imageConfig .Context , err = m .log .Question (& survey.QuestionOptions {
92- Question : "What is the build context for building this image?" ,
93- DefaultValue : path .Dir (imageConfig .Dockerfile ) + "/" ,
94- ValidationFunc : func (value string ) error {
95- stat , err := os .Stat (value )
96- if err != nil && ! stat .IsDir () {
97- return errors .New ("Context path does not exist or is not a directory" )
98- }
99- return nil
100- },
101- })
102- if err != nil {
103- return err
95+ if imageConfig .Dockerfile != "" {
96+ imageConfig .Context , err = m .log .Question (& survey.QuestionOptions {
97+ Question : "What is the build context for building this image?" ,
98+ DefaultValue : path .Dir (imageConfig .Dockerfile ) + "/" ,
99+ ValidationFunc : func (value string ) error {
100+ stat , err := os .Stat (value )
101+ if err != nil && ! stat .IsDir () {
102+ return errors .New ("Context path does not exist or is not a directory" )
103+ }
104+ return nil
105+ },
106+ })
107+ if err != nil {
108+ return err
109+ }
110+ } else {
111+ buildMethod = skip
104112 }
105113 }
106114 }
107115
108- if image == "" {
116+ if image == "" && buildMethod != skip {
109117 // Ignore error as context may not be a Space
110118 kubeContext , err := m .factory .NewKubeConfigLoader ().GetCurrentContext ()
111119 if err != nil {
@@ -200,8 +208,12 @@ func (m *manager) AddImage(imageName, image, projectNamespace, dockerfile string
200208 }
201209 }
202210
203- m .config .Images [imageName ] = imageConfig
211+ if buildMethod == skip {
212+ imageConfig .Image = "username/app"
213+ imageConfig .Dockerfile = "./Dockerfile"
214+ }
204215
216+ m .config .Images [imageName ] = imageConfig
205217 return nil
206218}
207219
0 commit comments