Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
e50b028c00 | |||
867dda8e7c | |||
d12d595f21 | |||
6117228ea4 | |||
b6b584f808 | |||
48fe6ce0a8 |
@ -65,6 +65,8 @@ sast:
|
|||||||
|
|
||||||
testSTABLE:
|
testSTABLE:
|
||||||
image: hosttoday/ht-docker-dbase:npmci
|
image: hosttoday/ht-docker-dbase:npmci
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
|
888
package-lock.json
generated
888
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/docker",
|
"name": "@mojoio/docker",
|
||||||
"version": "1.0.29",
|
"version": "1.0.32",
|
||||||
"description": "easy communication with docker remote api from node, TypeScript ready",
|
"description": "easy communication with docker remote api from node, TypeScript ready",
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -27,19 +27,19 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/dockersock#README",
|
"homepage": "https://gitlab.com/pushrocks/dockersock#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^3.0.4",
|
"@pushrocks/lik": "^3.0.10",
|
||||||
"@pushrocks/smartlog": "^2.0.9",
|
"@pushrocks/smartlog": "^2.0.19",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"@pushrocks/smartrequest": "^1.1.14",
|
"@pushrocks/smartrequest": "^1.1.16",
|
||||||
"rxjs": "^6.3.3"
|
"rxjs": "^6.5.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.4",
|
"@gitzone/tsbuild": "^2.1.11",
|
||||||
"@gitzone/tsrun": "^1.1.17",
|
"@gitzone/tsrun": "^1.2.8",
|
||||||
"@gitzone/tstest": "^1.0.18",
|
"@gitzone/tstest": "^1.0.24",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.11",
|
||||||
"@types/node": "^10.12.18",
|
"@types/node": "^12.7.1",
|
||||||
"tslint": "^5.12.0",
|
"tslint": "^5.18.0",
|
||||||
"tslint-config-prettier": "^1.17.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,11 @@ export class DockerContainer {
|
|||||||
/**
|
/**
|
||||||
* get all containers
|
* get all containers
|
||||||
*/
|
*/
|
||||||
static async getContainers(dockerHostArg: DockerHost): Promise<DockerContainer[]> {
|
public static async getContainers(dockerHostArg: DockerHost): Promise<DockerContainer[]> {
|
||||||
const result: DockerContainer[] = [];
|
const result: DockerContainer[] = [];
|
||||||
const response = await dockerHostArg.request('GET', '/containers/json');
|
const response = await dockerHostArg.request('GET', '/containers/json');
|
||||||
|
|
||||||
|
// TODO: Think about getting the config by inpsecting the container
|
||||||
for (const containerResult of response.body) {
|
for (const containerResult of response.body) {
|
||||||
result.push(new DockerContainer(containerResult));
|
result.push(new DockerContainer(containerResult));
|
||||||
}
|
}
|
||||||
@ -21,11 +23,17 @@ export class DockerContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* gets an container by Id
|
||||||
* @param containerId
|
* @param containerId
|
||||||
*/
|
*/
|
||||||
static async getContainerById(containerId: string) {}
|
public static async getContainerById(containerId: string) {}
|
||||||
static async create() {}
|
|
||||||
|
/**
|
||||||
|
* create a container
|
||||||
|
*/
|
||||||
|
public static async create(creationSpecifier: interfaces.IContainerCreationSpecifier) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// ========
|
// ========
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
|
@ -43,7 +43,13 @@ export class DockerHost {
|
|||||||
const response = await this.requestStreaming('GET', '/events');
|
const response = await this.requestStreaming('GET', '/events');
|
||||||
return plugins.rxjs.Observable.create(observer => {
|
return plugins.rxjs.Observable.create(observer => {
|
||||||
response.on('data', data => {
|
response.on('data', data => {
|
||||||
observer.next(data.toString());
|
const eventString = data.toString();
|
||||||
|
try {
|
||||||
|
const eventObject = JSON.parse(eventString);
|
||||||
|
observer.next(eventObject);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return () => {
|
return () => {
|
||||||
response.emit('end');
|
response.emit('end');
|
||||||
|
@ -2,13 +2,36 @@ import * as plugins from './dockersock.plugins';
|
|||||||
import { DockerHost } from './docker.classes.host';
|
import { DockerHost } from './docker.classes.host';
|
||||||
|
|
||||||
export class DockerImage {
|
export class DockerImage {
|
||||||
|
// STATIC
|
||||||
|
public static async createFromRegistry(dockerHostArg: DockerHost, dockerImageTag): Promise<DockerImage> {
|
||||||
|
const resultingImage = new DockerImage();
|
||||||
|
|
||||||
|
return resultingImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async createFromExistingImage(dockerHostArg: DockerHost, dockerImageTag) {}
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
/**
|
/**
|
||||||
* the tags for an image
|
* the tags for an image
|
||||||
*/
|
*/
|
||||||
tags: string[] = [];
|
public tags: string[] = [];
|
||||||
|
|
||||||
static async createFromRegsitry(dockerHostArg: DockerHost): Promise<DockerImage> {
|
/**
|
||||||
const resultingImage = new DockerImage();
|
* returns a boolean wether the image has a upstream image
|
||||||
return resultingImage;
|
*/
|
||||||
|
public isUpstreamImage (): boolean {
|
||||||
|
// TODO: implement isUpastreamImage
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public async pullLatestImageFromRegistry() : Promise<boolean> {
|
||||||
|
// TODO: implement pullLatestImageFromRegistry
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
import * as plugins from './dockersock.plugins';
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
|
import { DockerHost } from './docker.classes.host';
|
||||||
|
|
||||||
|
export class DockerNetwork {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
import * as plugins from './dockersock.plugins';
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
|
import { DockerHost } from './docker.classes.host';
|
||||||
|
|
||||||
|
export class DockerService {
|
||||||
|
|
||||||
|
}
|
@ -1 +1,5 @@
|
|||||||
export { DockerHost } from './docker.classes.host';
|
export * from './docker.classes.host';
|
||||||
|
export * from './docker.classes.container';
|
||||||
|
export * from './docker.classes.image';
|
||||||
|
export * from './docker.classes.network';
|
||||||
|
export * from './docker.classes.service';
|
||||||
|
7
ts/interfaces/container.ts
Normal file
7
ts/interfaces/container.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { DockerNetwork } from '../docker.classes.network';
|
||||||
|
|
||||||
|
export interface IContainerCreationSpecifier {
|
||||||
|
hostname: string;
|
||||||
|
domainName: string;
|
||||||
|
networks?: DockerNetwork[];
|
||||||
|
}
|
@ -1,2 +1,3 @@
|
|||||||
|
export * from './container';
|
||||||
export * from './label';
|
export * from './label';
|
||||||
export * from './port';
|
export * from './port';
|
||||||
|
Reference in New Issue
Block a user