mirror of
https://github.com/danbulant/docker-compose
synced 2026-05-20 12:58:43 +00:00
Merge pull request #39 from halfmatthalfcat/updateBuildAddPush
Added push command, updated build to allow parallel builds
This commit is contained in:
commit
b9cc752652
2 changed files with 61 additions and 6 deletions
15
index.d.ts
vendored
15
index.d.ts
vendored
|
|
@ -13,10 +13,11 @@ declare module "docker-compose" {
|
|||
exec(container:String, command:String, options: IDockerComposeOptions): Promise<IDockerComposeResult>;
|
||||
logs(container:String, command:String, options: IDockerComposeLogOptions): Promise<IDockerComposeResult>;
|
||||
run(service:String, command:String, options: IDockerComposeOptions): Promise<IDockerComposeResult>;
|
||||
buildAll(options: IDockerComposeOptions): Promise<IDockerComposeResult>;
|
||||
buildMany(services:String[], options: IDockerComposeOptions): Promise<IDockerComposeResult>;
|
||||
buildAll(options: IDockerComposeBuildOptions): Promise<IDockerComposeResult>;
|
||||
buildMany(services:String[], options: IDockerComposeBuildOptions): Promise<IDockerComposeResult>;
|
||||
buildOne(service:String, options: IDockerComposeOptions): Promise<IDockerComposeResult>;
|
||||
ps(options: IDockerComposeOptions): Promise<IDockerComposeResult>;
|
||||
push(options: IDockerComposePushOptions): Promise<IDockerComposeResult>;
|
||||
}
|
||||
|
||||
interface IDockerComposeOptions {
|
||||
|
|
@ -25,10 +26,18 @@ declare module "docker-compose" {
|
|||
log?: boolean;
|
||||
}
|
||||
|
||||
interface IDockerComposeLogOptions extends IDockerComposeOptions{
|
||||
interface IDockerComposeLogOptions extends IDockerComposeOptions {
|
||||
follow: boolean;
|
||||
}
|
||||
|
||||
interface IDockerComposeBuildOptions extends IDockerComposeOptions {
|
||||
parallel?: boolean;
|
||||
}
|
||||
|
||||
interface IDockerComposePushOptions extends IDockerComposeOptions {
|
||||
ignorePushFailures?: boolean;
|
||||
}
|
||||
|
||||
interface IDockerComposeResult {
|
||||
out: string;
|
||||
err: string;
|
||||
|
|
|
|||
52
index.js
52
index.js
|
|
@ -182,13 +182,18 @@ const run = function (container, command, options) {
|
|||
* @param {object} options
|
||||
* @param {string} options.cwd
|
||||
* @param {boolean} [options.log]
|
||||
* @param {?boolean} [options.parallel]
|
||||
* @param {?(string|string[])} [options.config]
|
||||
* @param {?object} [options.env]
|
||||
*
|
||||
* @return {object} std.out / std.err
|
||||
*/
|
||||
const buildAll = function (options) {
|
||||
return execCompose('build', [], options);
|
||||
return execCompose(
|
||||
'build',
|
||||
options.parallel ? [ '--parallel' ] : [],
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -197,13 +202,18 @@ const buildAll = function (options) {
|
|||
* @param {object} options
|
||||
* @param {string} options.cwd
|
||||
* @param {boolean} [options.log]
|
||||
* @param {?boolean} [options.parallel]
|
||||
* @param {?(string|string[])} [options.config]
|
||||
* @param {?object} [options.env]
|
||||
*
|
||||
* @return {object} std.out / std.err
|
||||
*/
|
||||
const buildMany = function (services, options) {
|
||||
return execCompose('build', services, options);
|
||||
return execCompose(
|
||||
'build',
|
||||
options.parallel ? [ '--parallel' ].concat(services) : services,
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -233,6 +243,23 @@ const ps = function (options) {
|
|||
return execCompose('ps', [], options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Push command
|
||||
* @param {object} options
|
||||
* @param {string} options.cwd
|
||||
* @param {boolean} [options.log]
|
||||
* @param {?boolean} options.ignorePushFailures
|
||||
* @param {?(string|string[])} [options.config]
|
||||
* @param {?object} [options.env]
|
||||
*/
|
||||
const push = function (options) {
|
||||
return execCompose(
|
||||
'push',
|
||||
options.ignorePushFailures ? [ '--ignore-push-failures' ] : [],
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {object} options
|
||||
* @param {string} options.cwd
|
||||
|
|
@ -287,4 +314,23 @@ const logs = function (service, options) {
|
|||
return execCompose('logs', args, options);
|
||||
};
|
||||
|
||||
module.exports = { upAll, upMany, upOne, kill, down, stop, rm, exec, logs, restartAll, restartMany, restartOne, run, buildAll, buildMany, buildOne, ps };
|
||||
module.exports = {
|
||||
upAll,
|
||||
upMany,
|
||||
upOne,
|
||||
kill,
|
||||
down,
|
||||
stop,
|
||||
rm,
|
||||
exec,
|
||||
logs,
|
||||
restartAll,
|
||||
restartMany,
|
||||
restartOne,
|
||||
run,
|
||||
buildAll,
|
||||
buildMany,
|
||||
buildOne,
|
||||
ps,
|
||||
push,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue