start Docker configuration

This commit is contained in:
Phil Kunz 2016-07-19 00:37:13 +02:00
parent c5413ca11d
commit e222456431
12 changed files with 121 additions and 25 deletions

10
dist/index.js vendored
View File

@ -1,8 +1,4 @@
"use strict"; "use strict";
const plugins = require("./npmdocker.plugins"); const promisechain = require("./npmdocker.promisechain");
let config = plugins.npmextra.dataFor({ promisechain.run();
toolName: "npmdocker", //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsTUFBWSxZQUFZLFdBQU0sMEJBQTBCLENBQUMsQ0FBQTtBQUV6RCxZQUFZLENBQUMsR0FBRyxFQUFFLENBQUMifQ==
defaultSettings: {},
cwd: ""
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxPQUFPLFdBQU0scUJBQXFCLENBQUMsQ0FBQTtBQUsvQyxJQUFJLE1BQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLE9BQU8sQ0FBQztJQUNsQyxRQUFRLEVBQUMsV0FBVztJQUNwQixlQUFlLEVBQUUsRUFBRTtJQUNuQixHQUFHLEVBQUUsRUFBRTtDQUNWLENBQUMsQ0FBQyJ9

3
dist/npmdocker.config.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
/// <reference types="q" />
import * as plugins from "./npmdocker.plugins";
export declare let run: () => plugins.q.Promise<{}>;

13
dist/npmdocker.config.js vendored Normal file
View File

@ -0,0 +1,13 @@
"use strict";
const plugins = require("./npmdocker.plugins");
let config = plugins.npmextra.dataFor({
toolName: "npmdocker",
defaultSettings: {},
cwd: ""
});
exports.run = () => {
let done = plugins.q.defer();
done.resolve(config);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFHL0MsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUM7SUFDbEMsUUFBUSxFQUFDLFdBQVc7SUFDcEIsZUFBZSxFQUFFLEVBQUU7SUFDbkIsR0FBRyxFQUFFLEVBQUU7Q0FDVixDQUFDLENBQUM7QUFFUSxXQUFHLEdBQUc7SUFDYixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDckIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFBIn0=

View File

@ -5,3 +5,4 @@ import * as plugins from "./npmdocker.plugins";
*/ */
export declare let checkDocker: () => plugins.q.Promise<{}>; export declare let checkDocker: () => plugins.q.Promise<{}>;
export declare let makeDockerReady: () => void; export declare let makeDockerReady: () => void;
export declare let run: (configArg: any) => plugins.q.Promise<{}>;

View File

@ -14,4 +14,9 @@ exports.checkDocker = () => {
return done.promise; return done.promise;
}; };
exports.makeDockerReady = () => { }; exports.makeDockerReady = () => { };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmRvY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5kb2NrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFHL0M7O0dBRUc7QUFDUSxtQkFBVyxHQUFHO0lBQ3JCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQ2hDLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNuQixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksS0FBSyxDQUFDLGtDQUFrQyxDQUFDLENBQUMsQ0FBQztJQUMvRCxDQUFDO0lBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDO0FBRVMsdUJBQWUsR0FBRyxRQUFPLENBQUMsQ0FBQyJ9 exports.run = (configArg) => {
let done = plugins.q.defer();
done.resolve(configArg);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmRvY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5kb2NrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFHL0M7O0dBRUc7QUFDUSxtQkFBVyxHQUFHO0lBQ3JCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQ2hDLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNuQixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksS0FBSyxDQUFDLGtDQUFrQyxDQUFDLENBQUMsQ0FBQztJQUMvRCxDQUFDO0lBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDO0FBRVMsdUJBQWUsR0FBRyxRQUFPLENBQUMsQ0FBQztBQUUzQixXQUFHLEdBQUcsQ0FBQyxTQUFTO0lBQ3ZCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUN4QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUEifQ==

View File

@ -1,3 +1,3 @@
/// <reference types="q" /> /// <reference types="q" />
import * as plugins from "./npmdocker.plugins"; import * as plugins from "./npmdocker.plugins";
export declare let promisechain: () => plugins.q.Promise<{}>; export declare let run: () => plugins.q.Promise<{}>;

View File

@ -1,7 +1,13 @@
"use strict"; "use strict";
const plugins = require("./npmdocker.plugins"); const plugins = require("./npmdocker.plugins");
exports.promisechain = () => { //modules
const ConfigModule = require("./npmdocker.config");
const DockerModule = require("./npmdocker.docker");
exports.run = () => {
let done = plugins.q.defer(); let done = plugins.q.defer();
ConfigModule.run()
.then(DockerModule.run)
.then(done.resolve);
return done.promise; return done.promise;
}; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnByb21pc2VjaGFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5wcm9taXNlY2hhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFJcEMsb0JBQVksR0FBRztJQUN0QixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQSJ9 //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnByb21pc2VjaGFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5wcm9taXNlY2hhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFHL0MsU0FBUztBQUNULE1BQVksWUFBWSxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDbkQsTUFBWSxZQUFZLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUV4QyxXQUFHLEdBQUc7SUFDYixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLFlBQVksQ0FBQyxHQUFHLEVBQUU7U0FDYixJQUFJLENBQUMsWUFBWSxDQUFDLEdBQUcsQ0FBQztTQUN0QixJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQ3ZCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQSJ9

View File

@ -1,12 +1,5 @@
import * as plugins from "./npmdocker.plugins"; import * as plugins from "./npmdocker.plugins";
import * as paths from "./npmdocker.paths"; import * as promisechain from "./npmdocker.promisechain";
import * as docker from "./npmdocker.docker";
import {promisechain} from "./npmdocker.promisechain";
let config = plugins.npmextra.dataFor({
toolName:"npmdocker",
defaultSettings: {},
cwd: ""
});
promisechain.run();

14
ts/npmdocker.config.ts Normal file
View File

@ -0,0 +1,14 @@
import * as plugins from "./npmdocker.plugins";
import * as paths from "./npmdocker.paths";
let config = plugins.npmextra.dataFor({
toolName:"npmdocker",
defaultSettings: {},
cwd: ""
});
export let run = () => {
let done = plugins.q.defer();
done.resolve(config);
return done.promise;
}

View File

@ -4,14 +4,60 @@ import * as paths from "./npmdocker.paths";
/** /**
* check if docker is available * check if docker is available
*/ */
export let checkDocker = () => { let checkDocker = (configArg) => {
let done = plugins.q.defer(); let done = plugins.q.defer();
if(plugins.shelljs.which("docker")){ if(plugins.shelljs.which("docker")){
done.resolve(); done.resolve(configArg);
} else { } else {
done.reject(new Error("docker not found on this machine")); done.reject(new Error("docker not found on this machine"));
} }
return done.promise; return done.promise;
}; };
export let makeDockerReady = () => {}; /**
* builds the Dockerfile according to the config in the project
*/
let buildDockerFile = () => {
let done = plugins.q.defer();
return done.promise
};
/**
* builds the Dockerimage from the built Dockerfile
*/
let buildDockerImage = () => {
let done = plugins.q.defer();
return done.promise
};
/**
* creates a container by running the built Dockerimage
*/
let runDockerImage = () => {
let done = plugins.q.defer();
return done.promise
};
let deleteDockerContainter = () => {
let done = plugins.q.defer();
return done.promise
};
let deleteDockerImage = () => {
let done = plugins.q.defer();
return done.promise
};
export let run = (configArg) => {
let done = plugins.q.defer();
checkDocker(configArg)
.then(buildDockerFile)
.then(buildDockerImage)
.then(runDockerImage)
.then(deleteDockerContainter)
.then(deleteDockerImage)
.then(done.resolve)
return done.promise;
}

View File

@ -1,8 +1,14 @@
import * as plugins from "./npmdocker.plugins"; import * as plugins from "./npmdocker.plugins";
import * as paths from "./npmdocker.paths"; import * as paths from "./npmdocker.paths";
import * as docker from "./npmdocker.docker";
export let promisechain = () => { //modules
import * as ConfigModule from "./npmdocker.config";
import * as DockerModule from "./npmdocker.docker";
export let run = () => {
let done = plugins.q.defer(); let done = plugins.q.defer();
ConfigModule.run()
.then(DockerModule.run)
.then(done.resolve)
return done.promise; return done.promise;
} }

13
ts/npmdocker.snippets.ts Normal file
View File

@ -0,0 +1,13 @@
import * as plugins from "./npmdocker.plugins";
export interface IDockerfileSnippet {
baseImage:string;
command:string;
}
export let dockerfileSnippet = (optionsArg:IDockerfileSnippet) => {
return `
FROM ${optionsArg.baseImage}
`
}