dockerignore

Command line tool for creating or updating a .dockerignore file based on .gitignore.

Usage no npm install needed!

<script type="module">
  import dockerignore from 'https://cdn.skypack.dev/dockerignore';
</script>

README

dockerignore NPM version

Command line tool for creating or updating a .dockerignore file based on .gitignore.

Install globally with npm:

npm i -g dockerignore

Usage

Say .gitignore has:

node_modules
test/actual

And you want .dockerignore to have:

node_modules
test/actual
test/fixtures

In the command line run:

dockerignore "test/fixtures"

An .dockerignore file will be created, or updated:

node_modules
test/actual

# dockerignore
test/fixtures

Heads up!

The # dockerignore comment is used to ensure that .dockerignore reflects the latest changes in your .gitignore file, just by running dockerignore in the command line.

_If you want to preserve everything in your .dockerignore file, regardless of what is in .gitignore, just add the # dockerignore comment at the top of the .dockerignore file.

CLI commands

  • -i|--ignore: comma-separated list of patterns to add to .dockerignore
  • -u|--unignore: comma-separated list of patterns to remove from .dockerignore. This will not un-ignore patterns in .gitignore.
  • -D|--dest: optionally define a different destination filepath. Good for test driving to see what will be generated in advance.
  • -g|--gitignore: alternate source filepath for .gitignore.
  • -d|--dockerignore: alternate source filepath for .dockerignore.

API

To use via API, first:

npm i dockerignore --save

Then:

var dockerignore = require('dockerignore');
dockerignore(dock, git, options);

Params

  • dock {String|Array}: String from .dockerignore or an array of patterns to use.
  • git {String|Array}: String from .gitignore or an array of patterns to use.
  • options {Object}
    • ignore Array of patterns to add to the existing patterns from .gitignore
    • unignore Array of patterns to remove from .dockerignore. This will not un-ignore patterns in .gitignore

Run tests

Install dev dependencies.

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Maintainer

James Talmage

Author of npmignore (of which this is a fork)

Jon Schlinkert

License

Original npmignore utility Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on March 17, 2015.