Socket
Socket
Sign inDemoInstall

dockerify

Package Overview
Dependencies
16
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dockerify

Prepares any tarball containing a project so that a docker image can be built from it.


Version published
Weekly downloads
3
Maintainers
1
Install size
396 kB
Created
Weekly downloads
 

Readme

Source

dockerify build status

Prepares any tarball containing a project so that a docker image can be built from it

var fs = require('fs')
  , dockerify = require('dockerify')

var intar = fs.createReadStream(__dirname + '/in.tar', 'utf8');
dockerify(intar, { strip: 1, dockerfile: __dirname + '/Dockerfile' })
  .on('error', console.error)
  .pipe(process.stdout)

command line example

# dockerify local file
cat in.tar | dockerify -l silly -c 'from ubuntu' -s 1 > out.tar

# dockerify github tarball
curl -L https://github.com/thlorenz/browserify-markdown-editor/archive/010-finished-dev-version.tar.gz |\
  dockerify -s 1 -c 'from dockerfile/nodejs\nadd . src\n' --gz > out.tar

Installation

npm install dockerify

Commandline Usage

dockerify <options> 

   Creates a tarball stream into which a .tar or .tar.gz file can be piped in order to be dockerized 

OPTIONS:

  -l, --loglevel    level at which to log: silly|verbose|info|warn|error|silent -- default: verbose
  
  -h, --help        Print this help message.

  -g, --gz          set this if you are piping a .tar.gz file

  -s, --strip       default: 0, sets the number of path segments to strip from each directory  

  -c, --content     content of the Dockerfile, defaults to reading --dockerfile or to 'from ubuntu\n'

  -d, --dockerfile  file to read Dockerfile content from in case opts.content wasn't provided 

  -o, --override    default: false if the project contains a Dockerfile at the root (after directories are stripped), 
                    it will be overwritten with the content/file provided if this option is set


EXAMPLES:
  
  dockerify a local tarball and strip outer directory, use default Dockerfile
    
    cat in.tar | dockerify -l silly -s 1 > out.tar

  dockerify a .tar.gz file release on github, setting dockerfile content - Note --gz option

    curl -L https://github.com/thlorenz/browserify-markdown-editor/archive/010-finished-dev-version.tar.gz |\
      dockerify -s 1 -c 'from dockerfile/nodejs\nadd . src\n' --gz > out.tar

API

tar(stream, opts) → {ReadableStream}

Modifies the given tar stream according to given options. The main purpose is adding a Dockerfile so the resulting tar stream can be piped direclty into docker build

Note

The returned tar stream emits the following events on top of the typical ReadableStream events:

  • entry emitted whenever an entry was processed and modified
  • existing-dockerfile emitted whenever an existing Dockerfile was found and used instead of the supplied one
  • overriding-dockerfile emitted whenever an exising Dockerfile was overridden with the supplied one
opts
  • {number=} opts.strip default: 0 sets the number of path segments to strip from each directory
  • {string=} opts.content content of the Dockerfile, defaults to read(opts.dockerfile) or 'from ubuntu\n'
  • {string=} opts.dockerfile file to read Dockerfile content from in case opts.content wasn't provided
  • {boolean=} opts.override default: false if the project contains a Dockerfile at the root (after directories are stripped), it will be overwritten with the content/file provided if this option is set

  • {Object} opts.stats allows setting mtime, mode, uname, gname, uid and gid of the created Dockefile

Parameters:
NameTypeDescription
stream ReadableStream

the original tar stream

opts Object

@see above

Source:
Returns:

the transformed tar stream

Type
ReadableStream
targz(stream, opts) → {ReadableStream}

Gunzips the .tar.gz stream and passes it along to tar.

Parameters:
NameTypeDescription
stream ReadableStream

.tar.gz stream

opts Object

@see tar

Source:
Returns:

the transformed tar stream

Type
ReadableStream

generated with docme

License

MIT

Keywords

FAQs

Last updated on 03 Apr 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc