Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:jgkim/heroku-container-tools into…
Browse files Browse the repository at this point in the history
… compose

# Conflicts:
#	README.md
  • Loading branch information
jgkim committed Jul 1, 2016
2 parents 627d7d4 + 664a115 commit 62196ec
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.DS_Store
npm-debug.log
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ link:
heroku plugins:link "$(shell pwd)"

unlink:
heroku plugins:uninstall heroku-docker
heroku plugins:uninstall heroku-container-tools

patch:
npm version patch
Expand Down
26 changes: 13 additions & 13 deletions readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Heroku Docker CLI plugin
# Heroku Container Tools CLI plugin

Heroku Toolbelt plugin to help configure, test and release apps to Heroku using Docker and Docker Compose.
Heroku Toolbelt plugin to help configure, test and release apps to Heroku using local containers.

## Installation

```
$ heroku plugins:install heroku-docker
$ heroku plugins:install heroku-container-tools
```

## Use

See the [Dev Center Documentation](https://devcenter.heroku.com/articles/introduction-local-development-with-docker) for details of use.

```
$ heroku help docker
Usage: heroku docker
$ heroku help container
Usage: heroku container
Use Docker to build and deploy Heroku apps
Use containers to build and deploy Heroku apps
Additional commands, type "heroku help COMMAND" for more details:
docker:init # create Dockerfile and docker-compose.yml
docker:release # create and release slug to app
container:init # create Dockerfile and docker-compose.yml
container:release # create and release slug to app
```

For help with a particular command:

```
$ heroku help docker:init
Usage: heroku docker:init
$ heroku help container:init
Usage: heroku container:init
-i, --image IMAGE # the Docker image from which to inherit
-f, --force # overwrite existing Dockerfile and docker-compose.yml
Expand All @@ -41,13 +41,13 @@ Usage: heroku docker:init
Checkout the plugin source code and tell the Heroku CLI to use your local version of the plugin (instead of the default one distributed with NPM).

```
$ git clone https://github.com/heroku/heroku-docker.git
$ cd heroku-docker
$ git clone https://github.com/heroku/heroku-container-tools.git
$ cd heroku-container-tools
$ npm install
$ heroku plugins:link .
```

### Add-ons

The mapping from Heroku add-on specified in `app.json` to container configured in `docker-composer.yml` is tracked in `lib\addons.js`.
The mapping from Heroku add-on specified in `app.json` to container configured in `docker-compose.yml` is tracked in `lib\addons.js`.
The mapping currently includes a limited subset of add-ons that we have tested. We welcome additions in the form of PRs.
8 changes: 6 additions & 2 deletions commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = function(topic) {
return {
topic: topic,
command: 'login',
flags: [{ name: 'verbose', char: 'v', hasValue: false }],
description: 'Logs in to the Heroku Docker registry',
needsApp: false,
needsAuth: true,
Expand All @@ -21,14 +22,14 @@ function* login(context, heroku) {
let password = context.auth.password;

try {
let user = yield dockerLogin(registry, password);
let user = yield dockerLogin(registry, password, context.flags.verbose);
}
catch (err) {
cli.error(`Error: docker login exited with ${ err }`);
}
}

function dockerLogin(registry, password) {
function dockerLogin(registry, password, verbose) {
return new Promise((resolve, reject) => {
let args = [
'login',
Expand All @@ -37,6 +38,9 @@ function dockerLogin(registry, password) {
`--password=${ password }`,
registry
];
if (verbose) {
console.log(['> docker'].concat(args).join(' '));
}
child.spawn('docker', args, { stdio: 'inherit' })
.on('exit', (code, signal) => {
if (signal || code) reject(signal || code);
Expand Down
15 changes: 11 additions & 4 deletions commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = function(topic) {
needsApp: true,
needsAuth: true,
args: [{ name: 'process', optional: true }],
flags: [{ name: 'verbose', char: 'v', hasValue: false }],
run: cli.command(co.wrap(push))
};
};
Expand All @@ -23,30 +24,33 @@ function* push(context, heroku) {
let resource = `${ registry }/${ context.app }/${ proc }`;

try {
let build = yield buildImage(resource, context.cwd);
let build = yield buildImage(resource, context.cwd, context.flags.verbose);
}
catch (err) {
cli.error(`Error: docker build exited with ${ err }`);
process.exit(1);
}

try {
let push = yield pushImage(resource);
let push = yield pushImage(resource, context.flags.verbose);
}
catch (err) {
cli.error(`Error: docker push exited with ${ err }`);
process.exit(1);
}
}

function buildImage(resource, cwd) {
function buildImage(resource, cwd, verbose) {
return new Promise((resolve, reject) => {
let args = [
'build',
'-t',
resource,
cwd
];
if (verbose) {
console.log(['> docker'].concat(args).join(' '));
}
child.spawn('docker', args, { stdio: 'inherit' })
.on('exit', (code, signal) => {
if (signal || code) reject(signal || code);
Expand All @@ -55,12 +59,15 @@ function buildImage(resource, cwd) {
});
}

function pushImage(resource) {
function pushImage(resource, verbose) {
return new Promise((resolve, reject) => {
let args = [
'push',
resource
];
if (verbose) {
console.log(['> docker'].concat(args).join(' '));
}
child.spawn('docker', args, { stdio: 'inherit' })
.on('exit', (code, signal) => {
if (signal || code) reject(signal || code);
Expand Down
4 changes: 2 additions & 2 deletions commands/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function release(context) {
}

function createRemoteSlug(slug) {
var lang = `heroku-docker (${ slug.name || 'unknown'})`;
var lang = `heroku-container-tools (${ slug.name || 'unknown'})`;
cli.log(`creating remote slug...`);
cli.log(`language-pack: ${ lang }`);
cli.log('remote process types:', modifiedProc);
Expand Down Expand Up @@ -190,7 +190,7 @@ function release(context) {
method: 'POST',
path: `${ app.path }/releases`,
headers: {
'Heroku-Deploy-Type': 'heroku-docker'
'Heroku-Deploy-Type': 'heroku-container-tools'
},
body: {
slug: id
Expand Down
8 changes: 4 additions & 4 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Contributing

You want to add new language support? Awesome!
Figured out a way to seamlessly integrate with docker-compose and addons? Even better!
We're in the very early stages of exploring the possibilities of Docker + Heroku,
Figured out a way to seamlessly integrate with heroku-container-tools and addons? Even better!
We're in the very early stages of exploring the possibilities of 3rd party containers on Heroku,
so all ideas are welcome.

The simplest way to get started is to clone the repo and symlink it to your
Expand All @@ -16,7 +16,7 @@ When you'd like to go back to using the official release:

```
make unlink
heroku plugins:install heroku-docker
heroku plugins:install heroku-container-tools
```

While developing, you can run the basic test suite:
Expand Down Expand Up @@ -65,7 +65,7 @@ The best way to start is by checking out the
## Documentation

Once you've got a working platform, be sure to document how to use it
with at least one example. One of the coolest parts about this Docker
with at least one example. One of the coolest parts about this container
workflow is how easy it is to get started quickly. Since all dependencies
are self-contained, you should be able to create a hello-world type
example that doesn't require the user to install anything new.
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ var pkg = require('./package.json');
module.exports = {
commands: [
require('./commands/index')(pkg),
require('./commands/init')(pkg.topic),
require('./commands/release')(pkg.topic),
require('./commands/login')(pkg.topic),
require('./commands/push')(pkg.topic)
require('./commands/push')(pkg.topic),
require('./commands/init')(pkg.topic),
require('./commands/release')(pkg.topic)
]
};
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"name": "heroku-docker",
"version": "2.0.0",
"topic": "docker",
"description": "Use Docker to build and deploy Heroku apps",
"name": "heroku-container-tools",
"version": "4.0.0",
"topic": "container",
"description": "Use containers to build and deploy Heroku apps",
"main": "index.js",
"repository": "https://github.com/heroku/heroku-docker",
"repository": "https://github.com/heroku/heroku-container-tools",
"scripts": {
"test": "mocha",
"depcheck": "depcheck || true"
},
"keywords": [
"heroku",
"docker",
"cli",
"heroku-plugin"
],
Expand Down

0 comments on commit 62196ec

Please sign in to comment.