Deploy nodejs to heroku with Babel to support ES6+
- Docker official: https://docs.docker.com/get-started/part2/#sample-dockerfile
- Docker cheat sheet: https://devhints.io/docker
- Docker-compose cheat sheet: https://devhints.io/docker-compose
- Build nodejs app image
docker build -t xxx/nodeapp:1.0 .
- Run image as a container:
docker container run -p 3000:3033 --name helloworld -d xxx/nodeapp:1.0
- Pass environment variable “name” with the -e option:
docker container run -p 3001:3033 --name customized -e "name=kazan" -d xxx/nodeapp:1.0
- Build nginx image:
docker build -t xxx/nginxbalancer:1.0 .
- Start container nginx based on above image:
docker container run -p 3033:80 -d vtdthang/nginxbalancer:1.0
docker image push xxx/swarm_balancer:1.0
with "xxx" is username docker hub
- Deploy
docker stack deploy -c docker-compose.yml swarmnodeapp