Welcome to the Habitat Sample Node App!
To practice packaging/running this app with Habitat
- Install and set up Habitat (Instructions here)
- Install Docker (Instructions here)
- Clone this repository
$ git clone https://github.com/habitat-sh/sample-node-app.git
- Change directories
$ cd sample-node-app
You'll see a directory called habitat. Open the habitat/plan.sh file:
Your habitat/plan.sh should look like this:
pkg_name=sample-node-app
pkg_origin=your_origin
pkg_scaffolding="core/scaffolding-node"
Let's add in a version number
pkg_name=sample-node-app
pkg_origin=your_origin
pkg_scaffolding="core/scaffolding-node"
pkg_version="1.0.1"
Now save and close the file.
Enter the Habitat Studio
$ hab studio enter
And run build
(studio) $ build
Still in your studio, right after the build, export that package to a docker image
(studio) $ hab pkg export docker ./results/<habitat artifact>.hart
Then exit out of the studio:
(studio) $ exit
Now start a Docker container from that image.
$ docker run -it -p 8000:8000 your_origin/sample-node-app
Now head to http://localhost:8000 and see your running app!