@ostro-cloud/cli 1.0.0-alpha.4 → 1.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -136,9 +136,13 @@ async function validateTemplate(options = {}) {
136
136
  }
137
137
  effectiveParams = loadEnvParams(templateDir, effectiveParams);
138
138
 
139
- const buildContextDir = fs.existsSync(path.join(templateDir, 'Dockerfile'))
140
- ? templateDir
141
- : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null);
139
+ const codeUriMatch = yamlContent.match(/^\s*(?:CodeUri|BuildContext)\s*:\s*['"]?([^\s'"#]+)['"]?/m);
140
+ const codeUriDir = codeUriMatch ? path.resolve(templateDir, codeUriMatch[1]) : null;
141
+ const buildContextDir = (codeUriDir && fs.existsSync(codeUriDir))
142
+ ? codeUriDir
143
+ : (fs.existsSync(path.join(templateDir, 'Dockerfile'))
144
+ ? templateDir
145
+ : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null));
142
146
 
143
147
  if (options.image) {
144
148
  effectiveParams = { ...effectiveParams, Image: options.image };
@@ -214,9 +218,13 @@ async function createStack(options = {}) {
214
218
  }
215
219
  effectiveParams = loadEnvParams(templateDir, effectiveParams);
216
220
 
217
- const buildContextDir = fs.existsSync(path.join(templateDir, 'Dockerfile'))
218
- ? templateDir
219
- : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null);
221
+ const codeUriMatch = yamlContent.match(/^\s*(?:CodeUri|BuildContext)\s*:\s*['"]?([^\s'"#]+)['"]?/m);
222
+ const codeUriDir = codeUriMatch ? path.resolve(templateDir, codeUriMatch[1]) : null;
223
+ const buildContextDir = (codeUriDir && fs.existsSync(codeUriDir))
224
+ ? codeUriDir
225
+ : (fs.existsSync(path.join(templateDir, 'Dockerfile'))
226
+ ? templateDir
227
+ : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null));
220
228
 
221
229
  if (options.image) {
222
230
  effectiveParams = { ...effectiveParams, Image: options.image };
@@ -286,9 +294,13 @@ async function deployStack(options = {}) {
286
294
  }
287
295
  effectiveParams = loadEnvParams(templateDir, effectiveParams);
288
296
 
289
- const buildContextDir = fs.existsSync(path.join(templateDir, 'Dockerfile'))
290
- ? templateDir
291
- : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null);
297
+ const codeUriMatch = yamlContent.match(/^\s*(?:CodeUri|BuildContext)\s*:\s*['"]?([^\s'"#]+)['"]?/m);
298
+ const codeUriDir = codeUriMatch ? path.resolve(templateDir, codeUriMatch[1]) : null;
299
+ const buildContextDir = (codeUriDir && fs.existsSync(codeUriDir))
300
+ ? codeUriDir
301
+ : (fs.existsSync(path.join(templateDir, 'Dockerfile'))
302
+ ? templateDir
303
+ : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null));
292
304
 
293
305
  if (options.image) {
294
306
  effectiveParams = { ...effectiveParams, Image: options.image };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ostro-cloud/cli",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "Enterprise Command Line Interface (CLI) for Ostro Cloud Serverless, S3 Buckets, Kubernetes, and CloudFormation Orchestration",
5
5
  "main": "lib/index.js",
6
6
  "bin": {