feat(imagestore): now processing images with extraction, retagging, repackaging and long term storage

This commit is contained in:
2024-06-08 15:03:19 +02:00
parent 740f83114c
commit c0cebbe614
13 changed files with 241 additions and 90 deletions

View File

@@ -1,8 +1,11 @@
import * as plugins from './plugins.js';
import * as interfaces from './interfaces/index.js';
import { DockerHost } from './classes.host.js';
import { logger } from './logging.js';
import { logger } from './logger.js';
/**
* represents a docker image on the remote docker host
*/
export class DockerImage {
// STATIC
public static async getImages(dockerHost: DockerHost) {
@@ -14,7 +17,7 @@ export class DockerImage {
return images;
}
public static async findImageByName(dockerHost: DockerHost, imageNameArg: string) {
public static async getImageByName(dockerHost: DockerHost, imageNameArg: string) {
const images = await this.getImages(dockerHost);
const result = images.find((image) => {
if (image.RepoTags) {
@@ -67,7 +70,7 @@ export class DockerImage {
);
if (response.statusCode < 300) {
logger.log('info', `Successfully pulled image ${imageUrlObject.imageUrl} from the registry`);
const image = await DockerImage.findImageByName(dockerHostArg, imageUrlObject.imageOriginTag);
const image = await DockerImage.getImageByName(dockerHostArg, imageUrlObject.imageOriginTag);
return image;
} else {
logger.log('error', `Failed at the attempt of creating a new image`);