24 lines
708 B
TypeScript
24 lines
708 B
TypeScript
import * as plugins from "./npmdocker.plugins";
|
|
|
|
export interface IDockerfileSnippet {
|
|
baseImage:string;
|
|
command:string;
|
|
}
|
|
|
|
export let dockerfileSnippet = (optionsArg:IDockerfileSnippet):string => {
|
|
let commandArray = optionsArg.command.split(/\s/);
|
|
let commandString:string = "";
|
|
for(let stringItem of commandArray){
|
|
if(!(commandString == "")){
|
|
commandString = commandString + ",";
|
|
}
|
|
commandString = commandString + '"' + stringItem + '"';
|
|
};
|
|
return plugins.smartstring.indent.normalize(`
|
|
FROM ${optionsArg.baseImage}
|
|
RUN mkdir /workspace
|
|
WORKDIR /workspace
|
|
ENV CI=true
|
|
CMD [${commandString}];
|
|
`);
|
|
} |