added dockerSock option

This commit is contained in:
2016-07-28 18:01:02 +02:00
parent ce996f43a0
commit 25b3cc1045
6 changed files with 20 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import * as paths from "./npmdocker.paths";
export interface IConfig {
baseImage:string;
command:string;
dockerSock:boolean;
exitCode?:number
}
@ -11,7 +12,8 @@ let config:IConfig = plugins.npmextra.dataFor({
toolName:"npmdocker",
defaultSettings: {
baseImage:"hosttoday/ht-docker-node:npmts",
command:"npm test"
command:"npm test",
dockerSock: false
}
});

View File

@ -70,7 +70,11 @@ let runDockerImage = () => {
let done = plugins.q.defer();
npmdockerOra.text("starting Container...");
npmdockerOra.end();
config.exitCode = plugins.shelljs.exec(`docker run -v ${paths.cwd}:/workspace --name ${dockerData.containerName} ${dockerData.imageTag}`).code;
let dockerSockString:string = "";
if(config.dockerSock){
dockerSockString = `-v /var/run/docker.sock:/var/run/docker.sock`
};
config.exitCode = plugins.shelljs.exec(`docker run -v ${paths.cwd}:/workspace ${dockerSockString} --name ${dockerData.containerName} ${dockerData.imageTag}`).code;
done.resolve();
return done.promise;
};