Compare commits
56 Commits
Author | SHA1 | Date | |
---|---|---|---|
1d0c4c3cf9 | |||
a037cba454 | |||
7009e07ecc | |||
7b8ef33e21 | |||
3011e599e8 | |||
8adb636db3 | |||
dd35e5d7d2 | |||
91d7f583e2 | |||
a77ed42e9f | |||
499c6cc3b7 | |||
19283fb695 | |||
b2d84b1399 | |||
7cc2374130 | |||
526bb5bbd0 | |||
14b2105a49 | |||
37efeffe69 | |||
943f46d620 | |||
cfb7c1ce06 | |||
489a47b9bf | |||
28fa5349d7 | |||
cc82b3af04 | |||
6a8751afd2 | |||
56612f9ac9 | |||
2a1fcd8cdb | |||
09911328b2 | |||
548e32419e | |||
2b2b06b48b | |||
37028a9b1f | |||
3cba5844d8 | |||
a3ceb68eab | |||
be659a2dbd | |||
144f963d8a | |||
0c7cd35448 | |||
4e3446cb2f | |||
cec9555908 | |||
14803c1569 | |||
2d2449890f | |||
5fd3a63822 | |||
5ae04ce5c2 | |||
2b3b991372 | |||
487ba592a7 | |||
60e3239d99 | |||
f23cc2eb82 | |||
de05d432b1 | |||
4a90510ff4 | |||
bfda5177a6 | |||
ad2a1ac03d | |||
99db0b902e | |||
515d2d4970 | |||
abf2234480 | |||
b4c6bff74d | |||
4da7f5194a | |||
c356042075 | |||
1d75c1334f | |||
0824d5b910 | |||
0575e618f2 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
docs/
|
||||
coverage/
|
||||
.yarn/
|
||||
node_modules/
|
||||
coverage/
|
||||
public/
|
||||
|
@ -1,38 +1,31 @@
|
||||
image: hosttoday/ht-docker-dbase
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .yarn/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
|
||||
before_script:
|
||||
- npmci prepare docker-gitlab
|
||||
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- npm install
|
||||
- npm test
|
||||
- npmci build docker
|
||||
tags:
|
||||
- lossless
|
||||
- priv
|
||||
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test docker
|
||||
- npmci test stable
|
||||
tags:
|
||||
- lossless
|
||||
- priv
|
||||
|
||||
release:
|
||||
image: hosttoday/ht-docker-node:npmts
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: release
|
||||
script:
|
||||
- npmci publish npm
|
||||
@ -43,6 +36,7 @@ release:
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: trigger
|
||||
script:
|
||||
- npmci trigger
|
||||
@ -50,4 +44,19 @@ trigger:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- priv
|
||||
- priv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: pages
|
||||
script:
|
||||
- npmci command yarn global add npmpage
|
||||
- npmci command npmpage --publish gitlab
|
||||
tags:
|
||||
- docker
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
@ -1,6 +0,0 @@
|
||||
FROM hosttoday/ht-docker-node:npmts
|
||||
RUN mkdir app-node
|
||||
COPY ./ /app-node/
|
||||
WORKDIR /app-node
|
||||
ENV CI true
|
||||
CMD ["npmts"]
|
36
README.md
36
README.md
@ -1,11 +1,29 @@
|
||||
# dockersock
|
||||
easy communication with docker from node, TypeScript ready
|
||||
# @mojoio/dockersock
|
||||
|
||||
## Status
|
||||
[](https://gitlab.com/pushrocks/dockersock/commits/master)
|
||||
easy communication with docker remote api from node, TypeScript ready
|
||||
|
||||
## Availabililty
|
||||
|
||||
[](https://www.npmjs.com/package/dockersock)
|
||||
[](https://GitLab.com/mojoio/dockersock)
|
||||
[](https://github.com/mojoio/dockersock)
|
||||
[](https://mojoio.gitlab.io/dockersock/)
|
||||
|
||||
## Status for master
|
||||
|
||||
[](https://GitLab.com/mojoio/dockersock/commits/master)
|
||||
[](https://GitLab.com/mojoio/dockersock/commits/master)
|
||||
[](https://www.npmjs.com/package/dockersock)
|
||||
[](https://david-dm.org/mojoio/dockersock)
|
||||
[](https://www.bithound.io/github/mojoio/dockersock/master/dependencies/npm)
|
||||
[](https://www.bithound.io/github/mojoio/dockersock)
|
||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
[](http://standardjs.com/)
|
||||
|
||||
## Usage
|
||||
We recommend the use of TypeScript for best Intellisense.
|
||||
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
```TypeScript
|
||||
import {Dockersock} from "dockersock"; // require Dockersock class
|
||||
@ -24,5 +42,11 @@ myDockersock.startContainer({ // starts a already present container
|
||||
myDockersock.newContainer({ // start new Container, equals "docker run" shell command
|
||||
image: "someimagetag"
|
||||
})
|
||||
```
|
||||
|
||||
```
|
||||
For further information read the linked docs at the top of this README.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[](https://mojo.io)
|
||||
|
22
dist/dockersock.classes.dockersock.d.ts
vendored
22
dist/dockersock.classes.dockersock.d.ts
vendored
@ -1,22 +0,0 @@
|
||||
import "typings-global";
|
||||
export declare class Dockersock {
|
||||
sockPath: string;
|
||||
constructor(pathArg?: string);
|
||||
auth(userArg: string, passArg: string): any;
|
||||
listContainers(): any;
|
||||
listContainersDetailed(): any;
|
||||
listContainersRunning(): any;
|
||||
listContainersStopped(): any;
|
||||
listImages(): any;
|
||||
listImagesDangling(): any;
|
||||
pullImage(imageLabel: string): any;
|
||||
createContainer(imageNameArg: any, pullFirst?: boolean): any;
|
||||
getContainerId(): void;
|
||||
startContainer(containerNameArg: any): any;
|
||||
stopContainer(containerNameArg: any): any;
|
||||
removeContainer(containerNameArg: any): any;
|
||||
clean(): any;
|
||||
getChange(): void;
|
||||
request(methodArg: string, routeArg: string, queryArg?: string, dataArg?: {}): any;
|
||||
requestStream(methodArg: any, routeArg: any, endArg?: boolean): any;
|
||||
}
|
153
dist/dockersock.classes.dockersock.js
vendored
153
dist/dockersock.classes.dockersock.js
vendored
File diff suppressed because one or more lines are too long
4
dist/dockersock.plugins.d.ts
vendored
4
dist/dockersock.plugins.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export declare let q: any;
|
||||
export declare let request: any;
|
7
dist/dockersock.plugins.js
vendored
7
dist/dockersock.plugins.js
vendored
@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.q = require("q");
|
||||
exports.request = require("request");
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRvY2tlcnNvY2sucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ1YsaUJBQVMsV0FBVyxXQUFXLENBQUMsQ0FBQztBQUNwQyxTQUFDLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ2pCLGVBQU8sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUMiLCJmaWxlIjoiZG9ja2Vyc29jay5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcbmV4cG9ydCBpbXBvcnQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTtcbmV4cG9ydCBsZXQgcSA9IHJlcXVpcmUoXCJxXCIpO1xuZXhwb3J0IGxldCByZXF1ZXN0ID0gcmVxdWlyZShcInJlcXVlc3RcIik7Il19
|
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
import "typings-global";
|
||||
export { Dockersock } from "./dockersock.classes.dockersock";
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var dockersock_classes_dockersock_1 = require("./dockersock.classes.dockersock");
|
||||
exports.Dockersock = dockersock_classes_dockersock_1.Dockersock;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsOENBQXlCLGlDQUFpQyxDQUFDO0FBQW5ELGdFQUFrRCIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5leHBvcnQge0RvY2tlcnNvY2t9IGZyb20gXCIuL2RvY2tlcnNvY2suY2xhc3Nlcy5kb2NrZXJzb2NrXCIiXX0=
|
@ -1,18 +1,18 @@
|
||||
nginx1 :
|
||||
image: "nginx"
|
||||
environment:
|
||||
VIRTUAL_HOST: "test100.labkomp.de"
|
||||
VIRTUAL_HOST: "test100.bleu.de"
|
||||
restart: always
|
||||
container_name: nginx1
|
||||
nginx2:
|
||||
image: nginx
|
||||
environment:
|
||||
VIRTUAL_HOST: "test101.labkomp.de"
|
||||
VIRTUAL_HOST: "test101.bleu.de"
|
||||
restart: always
|
||||
container_name: nginx2
|
||||
npmts-test-container:
|
||||
image: "npmts-test-image"
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||
nginx3:
|
||||
image: nginx
|
||||
environment:
|
||||
VIRTUAL_HOST: "test101.bleu.de"
|
||||
restart: always
|
||||
container_name: npmts-test-container
|
||||
container_name: nginx3
|
15
npmextra.json
Normal file
15
npmextra.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"npmts": {
|
||||
"mode": "default",
|
||||
"coverageTreshold": 10
|
||||
},
|
||||
"npmdocker": {
|
||||
"baseImage": "hosttoday/ht-docker-node:npmci",
|
||||
"command":
|
||||
"(ls -a && rm -r node_modules && yarn global add npmts && yarn install && npmts)",
|
||||
"dockerSock": true
|
||||
},
|
||||
"npmci": {
|
||||
"globalNpmTools": ["npmts", "npmdocker"]
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"mode":"default",
|
||||
"coverageTreshold":10
|
||||
}
|
444
package-lock.json
generated
Normal file
444
package-lock.json
generated
Normal file
@ -0,0 +1,444 @@
|
||||
{
|
||||
"name": "@mojoio/docker",
|
||||
"version": "1.0.24",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@airbnb/node-memwatch": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@airbnb/node-memwatch/-/node-memwatch-1.0.2.tgz",
|
||||
"integrity": "sha512-2R+MEEMSTUdKwQ6NFWkyA/UNoSjL1tMldZqJbZpgXSwNMBzlNlkUWEXKu9RqTTMkDqJRfGJ2VDs8gPlPK2APDQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bindings": "^1.3.0",
|
||||
"nan": "^2.9.2"
|
||||
}
|
||||
},
|
||||
"@pushrocks/lik": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/lik/-/lik-3.0.1.tgz",
|
||||
"integrity": "sha512-6dwRg7WMdY9drlqfo6NzOcw5ubVWYvIOSSMZz4Jsojpa8aDVwXd2VkD7sxO/PJRrbZzHkx/JXoY/epcWRjngUw==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"@types/lodash": "^4.14.112",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"lodash": "^4.17.10",
|
||||
"minimatch": "^3.0.4",
|
||||
"symbol-tree": "^3.2.2"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartdelay": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.1.tgz",
|
||||
"integrity": "sha512-olWwh2/JWfhmYdgqrR5RdSsgv1GlXBnbP+XKUrdKVk3dcCzkoqDx9lRE9NfpoCg1cUM2VMxbTVgTW9PWyexEuw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^2.0.5"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartlog": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog/-/smartlog-2.0.1.tgz",
|
||||
"integrity": "sha512-GtsDTGIUF3VuWPyF8FV5dF31ZCEIcaJ56ZlvJsWxjnyJq57X25mk5/K0QAaRE9IIeHg6fORcukFomb5C+AOQrg==",
|
||||
"requires": {
|
||||
"@pushrocks/smartlog-interfaces": "^1.0.9"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartlog-interfaces": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-1.0.9.tgz",
|
||||
"integrity": "sha512-0qwpomrRN0kFjmhR9m1iHYXoISoNuXtRP0Wr+JtkYyURLwKHMaW8Xoznf8MzXJptRfqufJi3Fxh5HodpPrIZUA=="
|
||||
},
|
||||
"@pushrocks/smartpromise": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartpromise/-/smartpromise-2.0.5.tgz",
|
||||
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
|
||||
},
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "1.0.17",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartrequest/-/smartrequest-1.0.17.tgz",
|
||||
"integrity": "sha512-kB4+N42rrNNdR72TQ3QduyEtYOoaUiPVtrXS3XhaqQ7AZAtIGDTIfkNMMfzMPJtYXpNGcG1AH+wZDsKvkjW4EQ==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^2.0.5"
|
||||
}
|
||||
},
|
||||
"@pushrocks/tapbundle": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.1.tgz",
|
||||
"integrity": "sha512-QWVz5EwB3sjjqHTMa22xuw78TBgVTyqKTF5H6HT9d/rvxL5Ag4ZrTuoadMPcU9hRBx9gtPsKbWq4lEwOHdCmLA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.1",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"early": "^2.1.1",
|
||||
"leakage": "^0.4.0",
|
||||
"smartchai": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.4.tgz",
|
||||
"integrity": "sha512-h6+VEw2Vr3ORiFCyyJmcho2zALnUq9cvdB/IO8Xs9itrJVCenC7o26A6+m7D0ihTTr65eS259H5/Ghl/VjYs6g==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/chai-as-promised": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.0.tgz",
|
||||
"integrity": "sha512-MFiW54UOSt+f2bRw8J7LgQeIvE/9b4oGvwU7XW30S9QGAiHGnU/fmiOprsyMkdmH2rl8xSPc0/yrQw8juXU6bQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chai": "*"
|
||||
}
|
||||
},
|
||||
"@types/chai-string": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai-string/-/chai-string-1.4.1.tgz",
|
||||
"integrity": "sha512-aRNMs6TKgjgPlCHwDfq/YNy5VtRR2hJ4AUWByddrT0TRVVD8eX4MiHW6/iHvmQHRlVuuPZcwnTUE7b4yFt7bEA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chai": "*"
|
||||
}
|
||||
},
|
||||
"@types/lodash": {
|
||||
"version": "4.14.112",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.112.tgz",
|
||||
"integrity": "sha512-jDD7sendv3V7iwyRXSlECOR8HCtMN2faVA9ngLdHHihSVIwY7nbfsKl2kA6fimUDU1i5l/zgpG3aevwWnN3zCQ=="
|
||||
},
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||
},
|
||||
"ansi-256-colors": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz",
|
||||
"integrity": "sha1-kQ3lDvzHwJ49gvL4er1rcAwYgYo=",
|
||||
"dev": true
|
||||
},
|
||||
"assertion-error": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||
"dev": true
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"beautycolor": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/beautycolor/-/beautycolor-1.0.11.tgz",
|
||||
"integrity": "sha512-Uxl/39+2uqixPzsrV+0NOHf0sJlWmsKnRTV0oz8+bfwnHPA/E+SZuh3Upn3OXobv0W7LZg5BVoLj1nkMj7m5jA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-256-colors": "^1.1.0",
|
||||
"typings-global": "^1.0.14"
|
||||
}
|
||||
},
|
||||
"bindings": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz",
|
||||
"integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"chai": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz",
|
||||
"integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"assertion-error": "^1.0.1",
|
||||
"check-error": "^1.0.1",
|
||||
"deep-eql": "^3.0.0",
|
||||
"get-func-name": "^2.0.0",
|
||||
"pathval": "^1.0.0",
|
||||
"type-detect": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"chai-as-promised": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"check-error": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"chai-string": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.4.0.tgz",
|
||||
"integrity": "sha1-NZFAwFHTak5LGl/GuRAVL0OKjUk=",
|
||||
"dev": true
|
||||
},
|
||||
"check-error": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"deep-eql": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"type-detect": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"define-properties": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz",
|
||||
"integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"foreach": "^2.0.5",
|
||||
"object-keys": "^1.0.8"
|
||||
}
|
||||
},
|
||||
"early": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/early/-/early-2.1.1.tgz",
|
||||
"integrity": "sha1-hB4jJU6l3FTYr67ugvWrZcAO4jw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"beautycolor": "^1.0.7",
|
||||
"smartq": "^1.1.1",
|
||||
"typings-global": "^1.0.16"
|
||||
}
|
||||
},
|
||||
"es-abstract": {
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz",
|
||||
"integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es-to-primitive": "^1.1.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.1",
|
||||
"is-callable": "^1.1.3",
|
||||
"is-regex": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"es-to-primitive": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz",
|
||||
"integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-callable": "^1.1.1",
|
||||
"is-date-object": "^1.0.1",
|
||||
"is-symbol": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"es6-error": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
|
||||
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
|
||||
"dev": true
|
||||
},
|
||||
"foreach": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
|
||||
"integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=",
|
||||
"dev": true
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"get-func-name": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
|
||||
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
||||
"dev": true
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"is-callable": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
|
||||
"integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
|
||||
"dev": true
|
||||
},
|
||||
"is-date-object": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
|
||||
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
|
||||
"dev": true
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
|
||||
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"is-symbol": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz",
|
||||
"integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=",
|
||||
"dev": true
|
||||
},
|
||||
"leakage": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/leakage/-/leakage-0.4.0.tgz",
|
||||
"integrity": "sha512-x7gYK5n5dPkHDZWJ2Kh8Ag1hZNzUh+HtXn8Bv1aDdN6o6ONPCJ8sOfFq+kxcULJFp3lXaCjXb3iXOLmQRbBLwA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@airbnb/node-memwatch": "^1.0.2",
|
||||
"es6-error": "^4.0.2",
|
||||
"left-pad": "^1.1.3",
|
||||
"minimist": "^1.2.0",
|
||||
"pretty-bytes": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"left-pad": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
|
||||
"integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.10",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
|
||||
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg=="
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"dev": true
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
|
||||
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==",
|
||||
"dev": true
|
||||
},
|
||||
"object-keys": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz",
|
||||
"integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==",
|
||||
"dev": true
|
||||
},
|
||||
"object.getownpropertydescriptors": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
|
||||
"integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.2",
|
||||
"es-abstract": "^1.5.1"
|
||||
}
|
||||
},
|
||||
"pathval": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
|
||||
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-bytes": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
|
||||
"integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=",
|
||||
"dev": true
|
||||
},
|
||||
"rxjs": {
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz",
|
||||
"integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"smartchai": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/smartchai/-/smartchai-2.0.1.tgz",
|
||||
"integrity": "sha512-9M+R56OhAHXScxgr2vzQqxGx0XMS0QXriNZuP7hjlbVbo2FUT+l60iEzbwPt9Ga+5u2cEEjSSoZEQVqlROaddA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chai": "^4.1.2",
|
||||
"@types/chai-as-promised": "^7.1.0",
|
||||
"@types/chai-string": "^1.4.0",
|
||||
"chai": "^4.1.2",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"chai-string": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"smartq": {
|
||||
"version": "1.1.8",
|
||||
"resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz",
|
||||
"integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"util.promisify": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"symbol-tree": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz",
|
||||
"integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY="
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"type-detect": {
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
||||
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
||||
"dev": true
|
||||
},
|
||||
"typings-global": {
|
||||
"version": "1.0.28",
|
||||
"resolved": "https://registry.npmjs.org/typings-global/-/typings-global-1.0.28.tgz",
|
||||
"integrity": "sha512-6VOwJWEY2971HOMHu/7sURzUXiD4/LiMJPsMAOqkHHAtS3MVpLFE5gzTiHilsH9KY5VE1mBQirWIgWFsDuo90A==",
|
||||
"dev": true
|
||||
},
|
||||
"util.promisify": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz",
|
||||
"integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.2",
|
||||
"object.getownpropertydescriptors": "^2.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
package.json
29
package.json
@ -1,13 +1,12 @@
|
||||
{
|
||||
"name": "dockersock",
|
||||
"version": "1.0.4",
|
||||
"description": "easy communication with docker from node, TypeScript ready",
|
||||
"name": "@mojoio/docker",
|
||||
"version": "1.0.24",
|
||||
"description": "easy communication with docker remote api from node, TypeScript ready",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "npmts --notest && npm run build && npm run startdocker && npm run cleanup",
|
||||
"build": "docker build -t npmts-test-image .",
|
||||
"startdocker": "docker run -v /var/run/docker.sock:/var/run/docker.sock --name npmts-test-container npmts-test-image",
|
||||
"cleanup": "docker rm npmts-test-container && docker rmi npmts-test-image"
|
||||
"test": "tsrun test/test.ts",
|
||||
"build": "(npmts --notest && npmdocker)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -27,14 +26,14 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/dockersock#README",
|
||||
"dependencies": {
|
||||
"beautylog": "^5.0.10",
|
||||
"q": "^1.4.1",
|
||||
"request": "^2.72.0",
|
||||
"typings-global": "^1.0.3"
|
||||
"@pushrocks/lik": "^3.0.1",
|
||||
"@pushrocks/smartlog": "^2.0.1",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"@pushrocks/smartrequest": "^1.0.17",
|
||||
"rxjs": "^6.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"npmts-g": "^5.2.6",
|
||||
"should": "^9.0.2",
|
||||
"typings-test": "^1.0.1"
|
||||
}
|
||||
"@pushrocks/tapbundle": "^3.0.1"
|
||||
},
|
||||
"private": false
|
||||
}
|
||||
|
2
test/test.d.ts
vendored
2
test/test.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
import "typings-test";
|
||||
import "should";
|
37
test/test.js
37
test/test.js
@ -1,37 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-test");
|
||||
require("should");
|
||||
var index_1 = require("../dist/index");
|
||||
describe("dockersock", function () {
|
||||
describe(".Dockersock()", function () {
|
||||
var testDockersock;
|
||||
it("should create a new Dockersock instance", function () {
|
||||
testDockersock = new index_1.Dockersock();
|
||||
testDockersock.should.be.instanceof(index_1.Dockersock);
|
||||
});
|
||||
it("should list containers", function (done) {
|
||||
testDockersock.listContainers()
|
||||
.then(function (dataArg) {
|
||||
console.log(dataArg);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should list detailed containers", function (done) {
|
||||
this.timeout(5000);
|
||||
testDockersock.listContainersDetailed()
|
||||
.then(function (dataArg) {
|
||||
console.log(dataArg);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should pull an image from imagetag", function (done) {
|
||||
this.timeout(10000);
|
||||
testDockersock.pullImage("nginx")
|
||||
.then(function (dataArg) {
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUVQLENBQUMsQ0FGYztBQUVmLHNCQUF5QixlQUV6QixDQUFDLENBRnVDO0FBRXhDLFFBQVEsQ0FBQyxZQUFZLEVBQUM7SUFDbEIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixJQUFJLGNBQXlCLENBQUM7UUFDOUIsRUFBRSxDQUFDLHlDQUF5QyxFQUFDO1lBQ3pDLGNBQWMsR0FBRyxJQUFJLGtCQUFVLEVBQUUsQ0FBQztZQUNsQyxjQUFjLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsa0JBQVUsQ0FBQyxDQUFDO1FBQ3BELENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLHdCQUF3QixFQUFDLFVBQVMsSUFBSTtZQUNyQyxjQUFjLENBQUMsY0FBYyxFQUFFO2lCQUMxQixJQUFJLENBQUMsVUFBQyxPQUFPO2dCQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7Z0JBQ3JCLElBQUksRUFBRSxDQUFDO1lBQ1gsQ0FBQyxDQUFDLENBQUM7UUFDWCxDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyxpQ0FBaUMsRUFBQyxVQUFTLElBQUk7WUFDOUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUNuQixjQUFjLENBQUMsc0JBQXNCLEVBQUU7aUJBQ2xDLElBQUksQ0FBQyxVQUFDLE9BQU87Z0JBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztnQkFDckIsSUFBSSxFQUFFLENBQUM7WUFDWCxDQUFDLENBQUMsQ0FBQztRQUNYLENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLG9DQUFvQyxFQUFDLFVBQVMsSUFBSTtZQUNqRCxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ3BCLGNBQWMsQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDO2lCQUM1QixJQUFJLENBQUMsVUFBQyxPQUFPO2dCQUNWLElBQUksRUFBRSxDQUFDO1lBQ1gsQ0FBQyxFQUFDLElBQUksQ0FBQyxDQUFDO1FBQ2hCLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy10ZXN0XCI7XG5pbXBvcnQgXCJzaG91bGRcIlxuXG5pbXBvcnQge0RvY2tlcnNvY2t9IGZyb20gXCIuLi9kaXN0L2luZGV4XCJcblxuZGVzY3JpYmUoXCJkb2NrZXJzb2NrXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5Eb2NrZXJzb2NrKClcIixmdW5jdGlvbigpe1xuICAgICAgICBsZXQgdGVzdERvY2tlcnNvY2s6RG9ja2Vyc29jaztcbiAgICAgICAgaXQoXCJzaG91bGQgY3JlYXRlIGEgbmV3IERvY2tlcnNvY2sgaW5zdGFuY2VcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2sgPSBuZXcgRG9ja2Vyc29jaygpO1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2suc2hvdWxkLmJlLmluc3RhbmNlb2YoRG9ja2Vyc29jayk7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCBsaXN0IGNvbnRhaW5lcnNcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgIHRlc3REb2NrZXJzb2NrLmxpc3RDb250YWluZXJzKClcbiAgICAgICAgICAgICAgICAudGhlbigoZGF0YUFyZyk9PntcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZGF0YUFyZyk7XG4gICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGl0KFwic2hvdWxkIGxpc3QgZGV0YWlsZWQgY29udGFpbmVyc1wiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgdGhpcy50aW1lb3V0KDUwMDApO1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2subGlzdENvbnRhaW5lcnNEZXRhaWxlZCgpXG4gICAgICAgICAgICAgICAgLnRoZW4oKGRhdGFBcmcpPT57XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGRhdGFBcmcpO1xuICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCBwdWxsIGFuIGltYWdlIGZyb20gaW1hZ2V0YWdcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgIHRoaXMudGltZW91dCgxMDAwMCk7XG4gICAgICAgICAgICB0ZXN0RG9ja2Vyc29jay5wdWxsSW1hZ2UoXCJuZ2lueFwiKVxuICAgICAgICAgICAgICAgIC50aGVuKChkYXRhQXJnKT0+e1xuICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgfSxkb25lKTtcbiAgICAgICAgfSlcbiAgICB9KTtcbn0pOyJdfQ==
|
60
test/test.ts
60
test/test.ts
@ -1,36 +1,28 @@
|
||||
import "typings-test";
|
||||
import "should"
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import { DockerHost } from '../ts/index';
|
||||
|
||||
import {Dockersock} from "../dist/index"
|
||||
let testDockerHost: DockerHost;
|
||||
|
||||
describe("dockersock",function(){
|
||||
describe(".Dockersock()",function(){
|
||||
let testDockersock:Dockersock;
|
||||
it("should create a new Dockersock instance",function(){
|
||||
testDockersock = new Dockersock();
|
||||
testDockersock.should.be.instanceof(Dockersock);
|
||||
});
|
||||
it("should list containers",function(done){
|
||||
testDockersock.listContainers()
|
||||
.then((dataArg)=>{
|
||||
console.log(dataArg);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should list detailed containers",function(done){
|
||||
this.timeout(5000);
|
||||
testDockersock.listContainersDetailed()
|
||||
.then((dataArg)=>{
|
||||
console.log(dataArg);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should pull an image from imagetag",function(done){
|
||||
this.timeout(10000);
|
||||
testDockersock.pullImage("nginx")
|
||||
.then((dataArg)=>{
|
||||
done();
|
||||
},done);
|
||||
})
|
||||
});
|
||||
});
|
||||
tap.test('should create a new Dockersock instance', async () => {
|
||||
testDockerHost = new DockerHost();
|
||||
return expect(testDockerHost).to.be.instanceof(DockerHost);
|
||||
});
|
||||
|
||||
tap.test('should list containers', async () => {
|
||||
const containers = await testDockerHost.getContainers();
|
||||
console.log(containers);
|
||||
});
|
||||
|
||||
/*
|
||||
tap.test('should pull an image from imagetag', async () => {
|
||||
await testDockerHost.pullImage('hosttoday/ht-docker-node:npmci');
|
||||
});
|
||||
|
||||
tap.skip.test('should return a change Objservable', async () => {
|
||||
let myObservable = testDockerHost.getChangeObservable();
|
||||
testDockerHost.endRequests();
|
||||
let testPromise = observableToPromise(myObservable);
|
||||
return await expect(testPromise).to.eventually.be.fulfilled;
|
||||
}); */
|
||||
|
||||
tap.start();
|
||||
|
@ -1,2 +0,0 @@
|
||||
docker build -t dockersock-image .
|
||||
docker-compose up
|
2
ts/docker.changes.ts
Normal file
2
ts/docker.changes.ts
Normal file
@ -0,0 +1,2 @@
|
||||
import * as plugins from './dockersock.plugins';
|
||||
|
10
ts/docker.classes.container.ts
Normal file
10
ts/docker.classes.container.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import * as plugins from './dockersock.plugins';
|
||||
import { DockerHost } from './docker.classes.host';
|
||||
|
||||
export class DockerContainer {
|
||||
static async getContainers(dockerHostArg: DockerHost): Promise<DockerContainer[]> {
|
||||
const result = [];
|
||||
await dockerHostArg.request('GET', '/containers/json')
|
||||
return result;
|
||||
}
|
||||
}
|
58
ts/docker.classes.host.ts
Normal file
58
ts/docker.classes.host.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import * as plugins from "./dockersock.plugins";
|
||||
import { DockerContainer } from "./docker.classes.container";
|
||||
|
||||
export class DockerHost {
|
||||
/**
|
||||
* the path where the docker sock can be found
|
||||
*/
|
||||
sockPath: string;
|
||||
|
||||
/**
|
||||
* keeping track of currently active requests to safely end this module at any time
|
||||
*/
|
||||
requestObjectmap = new plugins.lik.Objectmap<any>();
|
||||
|
||||
/**
|
||||
* the constructor to instantiate a new docker sock instance
|
||||
* @param pathArg
|
||||
*/
|
||||
constructor(pathArg: string = "http://unix:/var/run/docker.sock:") {
|
||||
this.sockPath = pathArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* authenticate against a registry
|
||||
* @param userArg
|
||||
* @param passArg
|
||||
*/
|
||||
auth(registryArg: string, userArg: string, passArg: string) {
|
||||
let done = plugins.smartpromise.defer();
|
||||
this.request("POST", "");
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async getContainers() {
|
||||
const containerArray = await DockerContainer.getContainers(this);
|
||||
return containerArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* fire a request
|
||||
*/
|
||||
async request(methodArg: string, routeArg: string, dataArg = {}) {
|
||||
const requestUrl = `${this.sockPath}${routeArg}`
|
||||
console.log(requestUrl);
|
||||
const response = await plugins.smartrequest.request(requestUrl, {
|
||||
method: methodArg,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Host": "docker.sock"
|
||||
},
|
||||
requestBody: dataArg
|
||||
});
|
||||
return response
|
||||
}
|
||||
}
|
14
ts/docker.classes.image.ts
Normal file
14
ts/docker.classes.image.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import * as plugins from './dockersock.plugins';
|
||||
import { DockerHost } from './docker.classes.host';
|
||||
|
||||
export class DockerImage {
|
||||
/**
|
||||
* the tags for an image
|
||||
*/
|
||||
tags: string[] = [];
|
||||
|
||||
static async createFromRegsitry(dockerHostArg: DockerHost): Promise<DockerImage> {
|
||||
const resultingImage = new DockerImage();
|
||||
return resultingImage;
|
||||
}
|
||||
}
|
0
ts/docker.classes.network.ts
Normal file
0
ts/docker.classes.network.ts
Normal file
0
ts/docker.classes.service.ts
Normal file
0
ts/docker.classes.service.ts
Normal file
@ -1,131 +0,0 @@
|
||||
import "typings-global"
|
||||
import * as plugins from "./dockersock.plugins";
|
||||
|
||||
export class Dockersock {
|
||||
sockPath:string;
|
||||
constructor(pathArg:string = "http://unix:/var/run/docker.sock:"){
|
||||
this.sockPath = pathArg;
|
||||
}
|
||||
|
||||
// methods
|
||||
auth(userArg:string,passArg:string){
|
||||
let done = plugins.q.defer();
|
||||
this.request("POST","");
|
||||
return done.promise;
|
||||
}
|
||||
listContainers() {
|
||||
let done = plugins.q.defer();
|
||||
this.request("GET","/containers")
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
||||
listContainersDetailed() {
|
||||
let done = plugins.q.defer();
|
||||
let detailedDataObject = [];
|
||||
this.listContainers()
|
||||
.then((dataArg) => {
|
||||
let recursiveCounter = 0;
|
||||
let makeDetailed = () => {
|
||||
if(typeof dataArg[recursiveCounter] != "undefined"){
|
||||
this.request("GET","/containers/" + dataArg[recursiveCounter].Id)
|
||||
.then((dataArg2) => {
|
||||
detailedDataObject.push(dataArg2);
|
||||
recursiveCounter++;
|
||||
// recursive call
|
||||
makeDetailed();
|
||||
});
|
||||
} else {
|
||||
done.resolve(detailedDataObject);
|
||||
}
|
||||
};
|
||||
makeDetailed();
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
listContainersRunning() {
|
||||
let done = plugins.q.defer();
|
||||
return done.promise;
|
||||
}
|
||||
listContainersStopped() {
|
||||
let done = plugins.q.defer();
|
||||
return done.promise;
|
||||
}
|
||||
listImages() {
|
||||
return this.request("GET","/images","?all=true");
|
||||
}
|
||||
listImagesDangling(){
|
||||
return this.request("GET","/images","?dangling=true");
|
||||
}
|
||||
pullImage(imageLabel:string){
|
||||
return this.requestStream("POST","/images/create?fromImage=" + imageLabel);
|
||||
};
|
||||
createContainer(imageNameArg,pullFirst:boolean = true){
|
||||
return this.request("POST","/containers/create","",{
|
||||
"image":imageNameArg
|
||||
});
|
||||
};
|
||||
getContainerId(){
|
||||
|
||||
};
|
||||
startContainer(containerNameArg){
|
||||
return this.request("POST","/containers/"+ containerNameArg +"/start");
|
||||
};
|
||||
stopContainer(containerNameArg){
|
||||
return this.request("POST","/containers/"+ containerNameArg +"/stop");
|
||||
};
|
||||
removeContainer(containerNameArg){
|
||||
return this.request("DELETE","/containers/" + containerNameArg + "?v=1");
|
||||
};
|
||||
clean() {
|
||||
let done = plugins.q.defer();
|
||||
return done.promise;
|
||||
};
|
||||
getChange(){
|
||||
|
||||
};
|
||||
request(methodArg:string,routeArg:string,queryArg:string = "", dataArg = {}){
|
||||
let done = plugins.q.defer();
|
||||
let jsonArg:string = JSON.stringify(dataArg);
|
||||
let suffix:string = "";
|
||||
if(methodArg == "GET") suffix = "/json";
|
||||
let options = {
|
||||
method:methodArg,
|
||||
url:this.sockPath + routeArg + suffix + queryArg,
|
||||
headers:{
|
||||
"Content-Type":"application/json"
|
||||
},
|
||||
body:jsonArg
|
||||
};
|
||||
plugins.request(options,(err, res, body) => {
|
||||
if (!err && res.statusCode == 200) {
|
||||
var responseObj = JSON.parse(body);
|
||||
done.resolve(responseObj);
|
||||
} else {
|
||||
console.log(err);
|
||||
console.log(res);
|
||||
done.reject(err);
|
||||
};
|
||||
});
|
||||
return done.promise;
|
||||
}
|
||||
requestStream(methodArg,routeArg,endArg:boolean = true){
|
||||
let done = plugins.q.defer();
|
||||
if(methodArg == "POST"){
|
||||
let requestStream = plugins.request.post(this.sockPath + routeArg)
|
||||
.on("response",(response) => {
|
||||
if(response.statusCode == 200){
|
||||
if(endArg == true){
|
||||
console.log("ending request");
|
||||
response.emit("end");
|
||||
} else {
|
||||
console.log("streaming forever");
|
||||
}
|
||||
done.resolve(response);
|
||||
} else {
|
||||
done.reject();
|
||||
}
|
||||
})
|
||||
}
|
||||
return done.promise;
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export let q = require("q");
|
||||
export let request = require("request");
|
||||
import 'typings-global';
|
||||
export import smartlog = require('@pushrocks/smartlog');
|
||||
export import lik = require('@pushrocks/lik');
|
||||
export import smartpromise = require('@pushrocks/smartpromise');
|
||||
export import smartrequest = require('@pushrocks/smartrequest');
|
||||
export import rxjs = require('rxjs');
|
||||
|
@ -1,2 +1 @@
|
||||
import "typings-global";
|
||||
export {Dockersock} from "./dockersock.classes.dockersock"
|
||||
export { DockerHost } from './docker.classes.host';
|
||||
|
Reference in New Issue
Block a user