npm install
npm run start
Then navigate to http://localhost:80/
docker build -t case-docker-api .
docker run -p 80:80 case-docker-api
You should see something like this:
> npm info it worked if it ends with ok
> npm info using npm@3.10.10
> npm info using node@v7.3.0
> npm info lifecycle case-docker-api@0.1.0~prestart: case-docker-api@0.1.0
> npm info lifecycle case-docker-api@0.1.0~start: case-docker-api@0.1.0
> case-docker-api@0.1.0 start /usr/src/app
> node ./server/server
> Example app listening on port 80!
You can use docker compose to accomplish this. In the project there are 2 docker compose files. One for dev and the other one for a production environment.
First create a docker image.
docker-compose build
Then start the app
For development
docker-compose -f docker-compose.yml up
or production
docker-compose -f docker-compose.production.yml up
As an example you will see there is a different environment setting for a database connection string in this project. This can be useful if you want to test the docker image on your local docker machine using a development database or rather connect to production database (or maybe another database..)
See Readme Case Docker API Zeit
See Readme Case Docker API Heroku