diff --git a/test/test.nonci.node.ts b/test/test.nonci.node.ts index 705cb3e..91e9ae5 100644 --- a/test/test.nonci.node.ts +++ b/test/test.nonci.node.ts @@ -8,7 +8,7 @@ import * as docker from '../ts/index.js'; let testDockerHost: docker.DockerHost; tap.test('should create a new Dockersock instance', async () => { - testDockerHost = new docker.DockerHost(); + testDockerHost = new docker.DockerHost({}); return expect(testDockerHost).toBeInstanceOf(docker.DockerHost); }); @@ -118,7 +118,7 @@ tap.test('should create a service', async () => { await testSecret.remove(); }); -tap.skip.test('should export images', async (toolsArg) => { +tap.test('should export images', async (toolsArg) => { const done = toolsArg.defer(); const testImage = await docker.DockerImage.createFromRegistry(testDockerHost, { creationObject: { diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 17f7361..55ffc2a 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@apiclient.xyz/docker', - version: '1.1.0', + version: '1.1.1', description: 'Provides easy communication with Docker remote API from Node.js, with TypeScript support.' } diff --git a/ts/classes.host.ts b/ts/classes.host.ts index 5a4babd..449bad3 100644 --- a/ts/classes.host.ts +++ b/ts/classes.host.ts @@ -4,6 +4,7 @@ import { DockerNetwork } from './classes.network.js'; import { DockerService } from './classes.service.js'; import { logger } from './logging.js'; import path from 'path'; +import type { DockerImageStore } from './classes.imagestore.js'; export interface IAuthData { serveraddress: string; @@ -11,21 +12,27 @@ export interface IAuthData { password: string; } +export interface IDockerHostConstructorOptions { + dockerSockPath?: string; + imageStoreDir?: string; +} + export class DockerHost { /** * the path where the docker sock can be found */ public socketPath: string; private registryToken: string = ''; + public imageStore: DockerImageStore; /** * the constructor to instantiate a new docker sock instance * @param pathArg */ - constructor(pathArg?: string) { + constructor(optionsArg: IDockerHostConstructorOptions) { let pathToUse: string; - if (pathArg) { - pathToUse = pathArg; + if (optionsArg.dockerSockPath) { + pathToUse = optionsArg.dockerSockPath; } else if (process.env.DOCKER_HOST) { pathToUse = process.env.DOCKER_HOST; } else if (process.env.CI) { diff --git a/ts/classes.imagestore.ts b/ts/classes.imagestore.ts index 2d72b30..e5575dc 100644 --- a/ts/classes.imagestore.ts +++ b/ts/classes.imagestore.ts @@ -1,5 +1,6 @@ import * as plugins from './plugins.js'; import * as paths from './paths.js'; +import type { DockerHost } from './classes.host.js'; export interface IDockerImageStoreConstructorOptions { dirPath: string; @@ -8,7 +9,7 @@ export interface IDockerImageStoreConstructorOptions { export class DockerImageStore { public options: IDockerImageStoreConstructorOptions; - constructor(optionsArg: IDockerImageStoreConstructorOptions) { + constructor(dockerHost: DockerHost, optionsArg: IDockerImageStoreConstructorOptions) { this.options = optionsArg; }