gdi

grunt-docker-io

Build, tag and push docker images

Showing:

Popularity

Downloads/wk

7

GitHub Stars

1

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

0

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

grunt-docker-io

Build and Push Docker Images

NPM

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-docker-io --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-docker-io');

The "docker_io" task

Overview

In your project's Gruntfile, add a section named docker_io to the data object passed into grunt.initConfig(). The docker_io section should include a target, in the example below we've named the target testimage.

grunt.initConfig({
  docker_io: {
    testimage: {
      options: {
        dockerFileLocation: '.',
        buildName: 'dockerIO',
        tag: 'latest',
        pushLocation: 'https://hub.docker.io',
        username: 'drgrove',
        push: true,
        force: true
      }
    }
  },
});

Options

options.dockerFileLocation

Type: String Default value: '.'

A string value that gives the location of the docker file relative to project root.

options.buildName

Type: String Default value: ''

A string value that is used to create the image name

options.tag

Type: String Default value: 'latest'

A string value for setting the images tag

options.pushLocation

Type: String Default value: 'https://hub.docker.io'

A string value for the location where you'd like to push for docker image

options.username

Type: String Default value: process.env.USER Required: true

Your Registry username.

options.push

Type: Boolean Default value: true

Push the image to a Docker Registry

options.force

Type: Boolean Default value: false

Force the tag creation

Usage Examples

Default Options

In this example, the default options are used to build the docker file in the current directory. The built image will be pushed to process.env.USER's test repository in the docker hub with a latest tag.

grunt.initConfig({
  docker_io: {
    testimage: {
      options: {
        dockerFileLocation: '.',
        buildName: 'test',
        tag: 'latest',
        pushLocation: 'https://hub.docker.io',
        username: process.env.USER, // Current logged in user
        push: true,
        force: false
      }
    }
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.1.0 - Initial Release (Ability to Build and Push Dockerfiles)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial