Add missing parameter type to buildImage (#18436)

https://github.com/apocas/dockerode#building-an-image3
This commit is contained in:
Byeong Hun Yoo
2017-07-28 00:02:58 +09:00
committed by Andy
parent 03c50b2890
commit 8742a3dec1
2 changed files with 15 additions and 4 deletions

View File

@@ -74,6 +74,10 @@ docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => {
// NOOP
});
docker.buildImage({context: '.', src: ['Dockerfile', 'test.sh']}, { t: 'imageName' }, (err, response) => {
// NOOP
});
docker.createContainer({ Tty: true }, (err, container) => {
container.start((err, data) => {
// NOOP

View File

@@ -1,6 +1,8 @@
// Type definitions for dockerode 2.4
// Project: https://github.com/apocas/dockerode
// Definitions by: Carl Winkler <https://github.com/seikho>, Nicolas Laplante <https://github.com/nlaplante>
// Definitions by: Carl Winkler <https://github.com/seikho>
// Nicolas Laplante <https://github.com/nlaplante>
// ByeongHun Yoo <https://github.com/isac322>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -804,6 +806,11 @@ declare namespace Dockerode {
tail?: number;
timestamps?: boolean;
}
interface ImageBuildContext {
context: string;
src: string[];
}
}
type Callback<T> = (error?: any, result?: T) => void;
@@ -830,9 +837,9 @@ declare class Dockerode {
checkAuth(options: any, callback: Callback<any>): void;
checkAuth(options: any): Promise<any>;
buildImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback<any>): void;
buildImage(file: string | NodeJS.ReadableStream, callback: Callback<any>): void;
buildImage(file: string | NodeJS.ReadableStream, options?: {}): Promise<any>;
buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options: {}, callback: Callback<any>): void;
buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, callback: Callback<any>): void;
buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options?: {}): Promise<any>;
getContainer(id: string): Dockerode.Container;