refactoring DockerfileService
This commit is contained in:
parent
ff6673fb07
commit
80b3666eb7
8 changed files with 326 additions and 263 deletions
43
static/js/services/dockerfile/dockerfile.service.ts
Normal file
43
static/js/services/dockerfile/dockerfile.service.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Service which provides helper methods for extracting information out from a Dockerfile
|
||||
* or an archive containing a Dockerfile.
|
||||
*/
|
||||
export abstract class DockerfileService {
|
||||
|
||||
/**
|
||||
* Retrieve Dockerfile from given archive file.
|
||||
* @param file File containing Dockerfile.
|
||||
* @param success Success callback with retrieved Dockerfile as parameter.
|
||||
* @param failure Failure callback with failure message as parameter.
|
||||
*/
|
||||
public abstract getDockerfile(file: any,
|
||||
success: (dockerfile: DockerfileInfo) => void,
|
||||
failure: (error: ErrorEvent | string) => void): void;
|
||||
|
||||
public abstract extractDockerfile(file: any): Promise<DockerfileInfo | string>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Model representing information about a specific Dockerfile.
|
||||
*/
|
||||
export abstract class DockerfileInfo {
|
||||
|
||||
/**
|
||||
* Extract the registry base image from the Dockerfile contents.
|
||||
* @return registryBaseImage The registry base image.
|
||||
*/
|
||||
public abstract getRegistryBaseImage(): string | null;
|
||||
|
||||
/**
|
||||
* Extract the base image from the Dockerfile contents.
|
||||
* @return baseImage The base image.
|
||||
*/
|
||||
public abstract getBaseImage(): string | null;
|
||||
|
||||
/**
|
||||
* Extract the base image and tag from the Dockerfile contents.
|
||||
* @return baseImageAndTag The base image and tag.
|
||||
*/
|
||||
public abstract getBaseImageAndTag(): string | null;
|
||||
}
|
Reference in a new issue