0.0.3 • Published 4 years ago

dockrr v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

dockrr

Build Status Coverage Status dockrr is an an NPM package for auto generating Dockerfile, building docker image, running and stopping the docker container in Node.js.

Installation

npm install dockrr --save-dev

Configuration

  1. Setup the dockrr config file in your application package.json file
...

"dockrr":{
    "cmd": "node index.js",
    "expose": 3000,
    "env": [
        { "name": "name 1" },
        { "metadata": "meta data 1" },
        { "path": "Log Path 1" }
      ],
    "label": [
        { "version": "1.0" }, 
        { "description": "A sample label" },
        { "maintainer": "nnamani.kenechukwu@gmail.com" }
      ],
    "workdir": "/app"
  },
  1. Add script to generate Dockerfile, build docker image, start and stop docker container in your scripts section of package.json file
....

"scripts": {
    "start": "node index.js",
    "dockrr-generate": "node ./node_modules/dockrr generate",
    "dockrr-build": "node ./node_modules/dockrr build",
    "dockrr-run": "node ./node_modules/dockrr run",
    "dockrr-stop": "node ./node_modules/dockrr stop"
  },

Alternatively, we can use dockrr aliases such as

....

"scripts": {
    "start": "node index.js",
    "dockrr-generate": "node ./node_modules/dockrr g",
    "dockrr-build": "node ./node_modules/dockrr b",
    "dockrr-run": "node ./node_modules/dockrr r",
    "dockrr-stop": "node ./node_modules/dockrr s"
  },

Usage

  1. To generate Dockerfile for your application, run
npm run dockrr-generate
  1. To build docker image using the generated Dockerfile, run
npm run dockrr-build
  1. To run the docker container using the built image, run
npm run dockrr-run

Visit the application on your web browser on http://localhost:<port number>/

  1. To stop the docker container, run
npm run dockrr-stop

dockrr config commands

CommandsDescriptionTypeRequired
cmdCommand that docker will use to start your applicationStringTrue
exposeThe application port which you want the container to run onIntegerTrue
envThe environment variables for dockerArray of ObjectsFalse
labelKey value pair of metadata to the imageArray of ObjectsFalse
workdirThe working directory in the DockerfileStringFalse

ISSUES

To report an issue or give feedback, Click link Issues and Feedback

Contributing

We are more than happy to have you contribute to this project.

License

MIT