improve README
This commit is contained in:
parent
526bb5bbd0
commit
7cc2374130
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,6 +1,4 @@
|
|||||||
docs/
|
|
||||||
coverage/
|
|
||||||
node_modules/
|
|
||||||
.yarn/
|
.yarn/
|
||||||
|
node_modules/
|
||||||
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
image: hosttoday/ht-docker-dbase:npmts
|
image: hosttoday/ht-docker-dbase:npmci
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .yarn/
|
||||||
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- trigger
|
- trigger
|
||||||
|
- pages
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- npmci prepare docker-gitlab
|
- npmci prepare docker-gitlab
|
||||||
@ -32,7 +38,7 @@ test:
|
|||||||
- priv
|
- priv
|
||||||
|
|
||||||
release:
|
release:
|
||||||
image: hosttoday/ht-docker-node:npmts
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci publish npm
|
- npmci publish npm
|
||||||
@ -43,7 +49,7 @@ release:
|
|||||||
- priv
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
image: hosttoday/ht-docker-node:npmts
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: trigger
|
stage: trigger
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
@ -52,3 +58,18 @@ trigger:
|
|||||||
tags:
|
tags:
|
||||||
- lossless
|
- 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
|
27
README.md
27
README.md
@ -1,11 +1,25 @@
|
|||||||
# dockersock
|
# dockersock
|
||||||
easy communication with docker remote api from node, TypeScript ready
|
easy communication with docker remote api from node, TypeScript ready
|
||||||
|
|
||||||
## Status
|
## Availabililty
|
||||||
[![build status](https://gitlab.com/pushrocks/dockersock/badges/master/build.svg)](https://gitlab.com/pushrocks/dockersock/commits/master)
|
[![npm](https://mojoio.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/dockersock)
|
||||||
|
[![git](https://mojoio.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/mojoio/dockersock)
|
||||||
|
[![git](https://mojoio.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/mojoio/dockersock)
|
||||||
|
[![docs](https://mojoio.gitlab.io/assets/repo-button-docs.svg)](https://mojoio.gitlab.io/dockersock/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[![build status](https://GitLab.com/mojoio/dockersock/badges/master/build.svg)](https://GitLab.com/mojoio/dockersock/commits/master)
|
||||||
|
[![coverage report](https://GitLab.com/mojoio/dockersock/badges/master/coverage.svg)](https://GitLab.com/mojoio/dockersock/commits/master)
|
||||||
|
[![npm downloads per month](https://img.shields.io/npm/dm/dockersock.svg)](https://www.npmjs.com/package/dockersock)
|
||||||
|
[![Dependency Status](https://david-dm.org/mojoio/dockersock.svg)](https://david-dm.org/mojoio/dockersock)
|
||||||
|
[![bitHound Dependencies](https://www.bithound.io/github/mojoio/dockersock/badges/dependencies.svg)](https://www.bithound.io/github/mojoio/dockersock/master/dependencies/npm)
|
||||||
|
[![bitHound Code](https://www.bithound.io/github/mojoio/dockersock/badges/code.svg)](https://www.bithound.io/github/mojoio/dockersock)
|
||||||
|
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
We recommend the use of TypeScript for best Intellisense.
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
```TypeScript
|
```TypeScript
|
||||||
import {Dockersock} from "dockersock"; // require Dockersock class
|
import {Dockersock} from "dockersock"; // require Dockersock class
|
||||||
@ -26,3 +40,10 @@ myDockersock.newContainer({ // start new Container, equals "docker run" shell co
|
|||||||
})
|
})
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
[![repo-footer](https://mojoio.gitlab.io/assets/repo-footer.svg)](https://mojo.io)
|
||||||
|
49
docs/README.md
Normal file
49
docs/README.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# dockersock
|
||||||
|
easy communication with docker remote api from node, TypeScript ready
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
[![npm](https://mojoio.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/dockersock)
|
||||||
|
[![git](https://mojoio.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/mojoio/dockersock)
|
||||||
|
[![git](https://mojoio.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/mojoio/dockersock)
|
||||||
|
[![docs](https://mojoio.gitlab.io/assets/repo-button-docs.svg)](https://mojoio.gitlab.io/dockersock/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[![build status](https://GitLab.com/mojoio/dockersock/badges/master/build.svg)](https://GitLab.com/mojoio/dockersock/commits/master)
|
||||||
|
[![coverage report](https://GitLab.com/mojoio/dockersock/badges/master/coverage.svg)](https://GitLab.com/mojoio/dockersock/commits/master)
|
||||||
|
[![npm downloads per month](https://img.shields.io/npm/dm/dockersock.svg)](https://www.npmjs.com/package/dockersock)
|
||||||
|
[![Dependency Status](https://david-dm.org/mojoio/dockersock.svg)](https://david-dm.org/mojoio/dockersock)
|
||||||
|
[![bitHound Dependencies](https://www.bithound.io/github/mojoio/dockersock/badges/dependencies.svg)](https://www.bithound.io/github/mojoio/dockersock/master/dependencies/npm)
|
||||||
|
[![bitHound Code](https://www.bithound.io/github/mojoio/dockersock/badges/code.svg)](https://www.bithound.io/github/mojoio/dockersock)
|
||||||
|
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
import {Dockersock} from "dockersock"; // require Dockersock class
|
||||||
|
|
||||||
|
let myDockersock = new Dockersock(); // optional: you can pass a domain to the contructor, defaults to /var/run/docker.sock
|
||||||
|
|
||||||
|
myDockersock.listContainers() // promise, resolve gets container data
|
||||||
|
myDockersock.listContainersDetailed() // promise, resolve gets more detailed container data (by combining several requests internally)
|
||||||
|
myDockersock.listContainersRunning() // promise, resolve gets container data for currently running containers
|
||||||
|
myDockersock.listContainersStopped() // promise, resolve gets container data for stopped containers
|
||||||
|
|
||||||
|
myDockersock.startContainer({ // starts a already present container
|
||||||
|
name: "somecontainername"
|
||||||
|
})
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
[![repo-footer](https://mojoio.gitlab.io/assets/repo-footer.svg)](https://mojo.io)
|
55
test/test.ts
55
test/test.ts
@ -1,35 +1,34 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
import { Dockersock } from "../dist/index";
|
|
||||||
import { expect, tap } from 'tapbundle'
|
import { expect, tap } from 'tapbundle'
|
||||||
|
|
||||||
tap.test("dockersock", function () {
|
import { Dockersock } from "../dist/index";
|
||||||
tap.test(function () {
|
|
||||||
let testDockersock: Dockersock;
|
let testDockersock: Dockersock;
|
||||||
tap.ok(function () {
|
|
||||||
|
tap.test("should create a new Dockersock instance", async () => {
|
||||||
testDockersock = new Dockersock();
|
testDockersock = new Dockersock();
|
||||||
testDockersock.should.be.instanceof(Dockersock);
|
return expect(testDockersock).to.be.instanceof(Dockersock);
|
||||||
}, "should create a new Dockersock instance");
|
});
|
||||||
tap.ok("should list containers", function (done) {
|
|
||||||
testDockersock.listContainers()
|
tap.test("should list containers", async () => {
|
||||||
.then((dataArg) => {
|
await testDockersock.listContainers()
|
||||||
|
.then(async (dataArg) => {
|
||||||
console.log(dataArg);
|
console.log(dataArg);
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
tap.ok(function (done) {
|
|
||||||
testDockersock.listContainersDetailed()
|
|
||||||
.then((dataArg) => {
|
|
||||||
console.log(dataArg);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
}, "should list detailed containers");
|
|
||||||
tap.ok(function () {
|
|
||||||
return testDockersock.pullImage("hosttoday/ht-docker-dbase")
|
|
||||||
}, "should pull an image from imagetag");
|
|
||||||
tap.ok(function (done) {
|
|
||||||
testDockersock.getChangeObservable();
|
|
||||||
testDockersock.endRequests();
|
|
||||||
done();
|
|
||||||
}, "should return a change Objservable")
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test("should list detailed containers", async () => {
|
||||||
|
await testDockersock.listContainersDetailed()
|
||||||
|
.then(async (dataArg) => {
|
||||||
|
console.log(dataArg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test("should pull an image from imagetag", async () => {
|
||||||
|
await testDockersock.pullImage("hosttoday/ht-docker-dbase")
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test("should return a change Objservable", async () => {
|
||||||
|
testDockersock.getChangeObservable();
|
||||||
|
testDockersock.endRequests();
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user