1 | # Node.js Getting Started
|
2 |
|
3 | ## Set up your environment
|
4 |
|
5 | Get the project:
|
6 |
|
7 | ```
|
8 | git clone https://github.com/heroku/node-js-getting-started.git
|
9 | cd node-js-getting-started
|
10 | ```
|
11 |
|
12 | Ensure that you can connect to Docker in this shell:
|
13 |
|
14 | ```
|
15 | docker ps
|
16 | ```
|
17 |
|
18 | ## Create a Dockerfile
|
19 |
|
20 | ```
|
21 | heroku docker:init
|
22 | ```
|
23 |
|
24 | Heroku-Docker will automatically detect that this project is a Node.js app.
|
25 |
|
26 | ## Work locally with Docker
|
27 |
|
28 | At this point, you have several available commands.
|
29 |
|
30 | For example,
|
31 | you could immediately build the project in Docker and release it to Heroku:
|
32 |
|
33 | ```
|
34 | heroku create
|
35 | heroku docker:release
|
36 | heroku open
|
37 | ```
|
38 |
|
39 | You can also run the server locally in a Dockerized version of Heroku's
|
40 | Cedar-14 stack:
|
41 |
|
42 | ```
|
43 | heroku docker:start
|
44 | ```
|
45 |
|
46 | Finally, you could open a shell in Docker to manipulate the project with
|
47 | commands like `npm install`:
|
48 |
|
49 | ```
|
50 | heroku docker:exec bash
|
51 | ```
|
52 |
|
53 | ...or run such commands directly:
|
54 |
|
55 | ```
|
56 | heroku docker:exec npm install --save express
|
57 | ```
|