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/
|
||||
node_modules/
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
@ -1,12 +1,18 @@
|
||||
image: hosttoday/ht-docker-dbase:npmts
|
||||
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
|
||||
@ -32,7 +38,7 @@ test:
|
||||
- priv
|
||||
|
||||
release:
|
||||
image: hosttoday/ht-docker-node:npmts
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: release
|
||||
script:
|
||||
- npmci publish npm
|
||||
@ -43,7 +49,7 @@ release:
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
image: hosttoday/ht-docker-node:npmts
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: trigger
|
||||
script:
|
||||
- npmci trigger
|
||||
@ -51,4 +57,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
|
29
README.md
29
README.md
@ -1,11 +1,25 @@
|
||||
# dockersock
|
||||
easy communication with docker remote api from node, TypeScript ready
|
||||
|
||||
## Status
|
||||
[![build status](https://gitlab.com/pushrocks/dockersock/badges/master/build.svg)](https://gitlab.com/pushrocks/dockersock/commits/master)
|
||||
## 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
|
||||
We recommend the use of TypeScript for best Intellisense.
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
```TypeScript
|
||||
import {Dockersock} from "dockersock"; // require Dockersock class
|
||||
@ -25,4 +39,11 @@ myDockersock.newContainer({ // start new Container, equals "docker run" shell co
|
||||
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)
|
||||
|
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)
|
61
test/test.ts
61
test/test.ts
@ -1,35 +1,34 @@
|
||||
import "typings-global";
|
||||
import { Dockersock } from "../dist/index";
|
||||
import { expect, tap } from 'tapbundle'
|
||||
|
||||
tap.test("dockersock", function () {
|
||||
tap.test(function () {
|
||||
let testDockersock: Dockersock;
|
||||
tap.ok(function () {
|
||||
testDockersock = new Dockersock();
|
||||
testDockersock.should.be.instanceof(Dockersock);
|
||||
}, "should create a new Dockersock instance");
|
||||
tap.ok("should list containers", function (done) {
|
||||
testDockersock.listContainers()
|
||||
.then((dataArg) => {
|
||||
console.log(dataArg);
|
||||
done();
|
||||
});
|
||||
import { Dockersock } from "../dist/index";
|
||||
|
||||
let testDockersock: Dockersock;
|
||||
|
||||
tap.test("should create a new Dockersock instance", async () => {
|
||||
testDockersock = new Dockersock();
|
||||
return expect(testDockersock).to.be.instanceof(Dockersock);
|
||||
});
|
||||
|
||||
tap.test("should list containers", async () => {
|
||||
await testDockersock.listContainers()
|
||||
.then(async (dataArg) => {
|
||||
console.log(dataArg);
|
||||
});
|
||||
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