added dockerSock option

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

View File

@ -3,6 +3,7 @@ import * as plugins from "./npmdocker.plugins";
export interface IConfig { export interface IConfig {
baseImage: string; baseImage: string;
command: string; command: string;
dockerSock: boolean;
exitCode?: number; exitCode?: number;
} }
export declare let run: () => plugins.q.Promise<{}>; export declare let run: () => plugins.q.Promise<{}>;

View File

@ -4,7 +4,8 @@ let config = plugins.npmextra.dataFor({
toolName: "npmdocker", toolName: "npmdocker",
defaultSettings: { defaultSettings: {
baseImage: "hosttoday/ht-docker-node:npmts", baseImage: "hosttoday/ht-docker-node:npmts",
command: "npm test" command: "npm test",
dockerSock: false
} }
}); });
exports.run = () => { exports.run = () => {
@ -12,4 +13,4 @@ exports.run = () => {
done.resolve(config); done.resolve(config);
return done.promise; return done.promise;
}; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFTL0MsSUFBSSxNQUFNLEdBQVcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUM7SUFDMUMsUUFBUSxFQUFDLFdBQVc7SUFDcEIsZUFBZSxFQUFFO1FBQ2IsU0FBUyxFQUFDLGdDQUFnQztRQUMxQyxPQUFPLEVBQUMsVUFBVTtLQUNyQjtDQUNKLENBQUMsQ0FBQztBQUVRLFdBQUcsR0FBRztJQUNiLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNyQixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUEifQ== //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFVL0MsSUFBSSxNQUFNLEdBQVcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUM7SUFDMUMsUUFBUSxFQUFDLFdBQVc7SUFDcEIsZUFBZSxFQUFFO1FBQ2IsU0FBUyxFQUFDLGdDQUFnQztRQUMxQyxPQUFPLEVBQUMsVUFBVTtRQUNsQixVQUFVLEVBQUUsS0FBSztLQUNwQjtDQUNKLENBQUMsQ0FBQztBQUVRLFdBQUcsR0FBRztJQUNiLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNyQixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUEifQ==

View File

@ -66,7 +66,12 @@ let runDockerImage = () => {
let done = plugins.q.defer(); let done = plugins.q.defer();
npmdocker_promisechain_1.npmdockerOra.text("starting Container..."); npmdocker_promisechain_1.npmdockerOra.text("starting Container...");
npmdocker_promisechain_1.npmdockerOra.end(); npmdocker_promisechain_1.npmdockerOra.end();
config.exitCode = plugins.shelljs.exec(`docker run -v ${paths.cwd}:/workspace --name ${dockerData.containerName} ${dockerData.imageTag}`).code; let dockerSockString = "";
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(); done.resolve();
return done.promise; return done.promise;
}; };
@ -103,4 +108,4 @@ exports.run = (configArg) => {
}); });
return done.promise; return done.promise;
}; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmRvY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5kb2NrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFDL0MsTUFBWSxLQUFLLFdBQU0sbUJBQW1CLENBQUMsQ0FBQTtBQUMzQyxNQUFZLFFBQVEsV0FBTSxzQkFBc0IsQ0FBQyxDQUFBO0FBRWpELHlDQUEyQiwwQkFBMEIsQ0FBQyxDQUFBO0FBRXRELElBQUksTUFBTSxDQUFDO0FBQ1gsSUFBSSxVQUFVLEdBQUc7SUFDYixRQUFRLEVBQUUsNkJBQTZCO0lBQ3ZDLGFBQWEsRUFBRSwwQkFBMEI7Q0FDNUMsQ0FBQztBQUVGOztHQUVHO0FBQ0gsSUFBSSxXQUFXLEdBQUc7SUFDZCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLHFDQUFZLENBQUMsSUFBSSxDQUFDLG9CQUFvQixDQUFDLENBQUM7SUFDeEMsRUFBRSxDQUFBLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQ2hDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLGVBQWUsQ0FBQyxDQUFBO1FBQ3JDLElBQUksQ0FBQyxPQ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ixJQUFJLENBQUMsc0JBQXNCLENBQUM7U0FDNUIsSUFBSSxDQUFDLGlCQUFpQixDQUFDO1NBQ3ZCLElBQUksQ0FBQztRQUNGLElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDekIsQ0FBQyxDQUFDLENBQUE7SUFDTixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUEifQ==

View File

@ -3,6 +3,7 @@
"version": "1.0.5", "version": "1.0.5",
"description": "develop npm modules cross platform with docker", "description": "develop npm modules cross platform with docker",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts",
"bin": { "bin": {
"npmdocker": "dist/cli.js" "npmdocker": "dist/cli.js"
}, },

View File

@ -4,6 +4,7 @@ import * as paths from "./npmdocker.paths";
export interface IConfig { export interface IConfig {
baseImage:string; baseImage:string;
command:string; command:string;
dockerSock:boolean;
exitCode?:number exitCode?:number
} }
@ -11,7 +12,8 @@ let config:IConfig = plugins.npmextra.dataFor({
toolName:"npmdocker", toolName:"npmdocker",
defaultSettings: { defaultSettings: {
baseImage:"hosttoday/ht-docker-node:npmts", 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(); let done = plugins.q.defer();
npmdockerOra.text("starting Container..."); npmdockerOra.text("starting Container...");
npmdockerOra.end(); 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(); done.resolve();
return done.promise; return done.promise;
}; };