tsdocker/ts/npmdocker.snippets.ts

21 lines
590 B
TypeScript
Raw Normal View History

2016-07-18 22:37:13 +00:00
import * as plugins from "./npmdocker.plugins";
export interface IDockerfileSnippet {
baseImage:string;
command:string;
}
2016-07-18 22:59:57 +00:00
export let dockerfileSnippet = (optionsArg:IDockerfileSnippet):string => {
let commandArray = optionsArg.command.split(" ");
let commandString:string = "";
for(let stringItem of commandArray){
if(!(commandString == "")){
commandString = commandString + ",";
}
commandString = commandString + '"' + stringItem + '"';
}
2016-07-18 22:37:13 +00:00
return `
FROM ${optionsArg.baseImage}
2016-07-18 22:59:57 +00:00
cmd[${commandString}];
2016-07-18 22:37:13 +00:00
`
}