UNPKG

2.38 kBMarkdownView Raw
1# Hacking on the plugin
2
3You want to add new language support? Awesome!
4We're in the very early stages of exploring the possibilities of Docker + Heroku,
5so all ideas are welcome.
6
7The simplest way to get started is to clone the repo and symlink it to your
8local Heroku client:
9
10```
11make link
12```
13
14When you'd like to go back to using the official release:
15
16```
17make unlink
18heroku plugins:install heroku-docker
19```
20
21While developing, you can run the basic test suite:
22
23```
24npm test
25```
26
27## Platform API
28
29All of the language support is in [/platforms](/platforms).
30To support a new platform, create a new directory with an index.js that
31exposes the following fields:
32
33### `name {String}`
34
35The name of the platform (node, java, etc).
36
37### `detect(dir) {Function:Boolean}`
38
39A function that returns `true` only if you detect that your platform is
40probably present in `dir`. For example, the node platform checks for
41the presence of a `package.json` file.
42
43### `getDockerfile(dir) {Function:String}`
44
45A function that returns the contents of a Dockerfile as a string.
46This Dockerfile will be used as the executable Dockerfile for
47projects running your platform.
48
49Two image types are created from each Dockerfile. The first is the
50`exec` image, which is used for a development environment. For example,
51node uses the `exec` image to run commands like `npm install` so that installed
52dependencies will be built for Heroku's Cedar-14 (Ubuntu) platform.
53
54The second image type is used for `start` and for `release`, and it's
55created via a 1-line temporary Dockerfile inheriting (FROM) the `exec` image.
56
57Thus, when you write your Dockerfile, if you want commands to be run
58only in the `start` and `release` phases, you should prefix those commands
59with `ONBUILD`.
60
61The best way to start is by checking out the
62[existing code in platforms](/platforms).
63
64## Documentation
65
66Once you've got a working platform, be sure to document how to use it
67with at least one example. One of the coolest parts about this Docker
68workflow is how easy it is to get started quickly. Since all dependencies
69are self-contained, you should be able to create a hello-world type
70example that doesn't require the user to install anything new.
71
72## Pull requests
73
74When your changes are ready, just send a PR - I'm aggressively
75merging them even when they're works in progress so we can keep momentum up.
76
77And thank you!