Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rama41222/docker-template
Dockerizing a Nodejs app
https://github.com/rama41222/docker-template
docker docker-compose docker-compose-template docker-container docker-demo docker-image docker-machine docker-registry dockerfile dockerfile-templating javascript nodejs nodejs-server
Last synced: about 9 hours ago
JSON representation
Dockerizing a Nodejs app
- Host: GitHub
- URL: https://github.com/rama41222/docker-template
- Owner: rama41222
- Created: 2019-08-30T19:45:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T03:51:12.000Z (about 2 years ago)
- Last Synced: 2023-03-08T14:40:05.398Z (almost 2 years ago)
- Topics: docker, docker-compose, docker-compose-template, docker-container, docker-demo, docker-image, docker-machine, docker-registry, dockerfile, dockerfile-templating, javascript, nodejs, nodejs-server
- Language: JavaScript
- Homepage:
- Size: 161 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Docker setup
------------
1. Create the .env
`mv .env.sample .env`
2. Add the environmental variables
3. Run
```
docker-compose up
docker-compose up -d #run in background
docker-compose down # remove
docker-compose stop # stop
docker-compose start # start stopped services
docker-compose run [service name] # run a single serivce in docker-compose manifest
docker-compose run web-cli # to ssh into the container
docker-compose build # Build the docker image
docker logs -f [container id] # to view logs
```### Deployment
Change the docker CMD to following
`CMD ["npm", "run" ,"start"]`### Build the image
**You have to manually add the user before running the image**
```
docker build . -t [repo-name]/[image-name]:[version]
docker run -it -p [host-port]:[container-port] [image-name] [cmd]
```
[Medium Article](https://itnext.io/lets-dockerize-a-nodejs-express-api-22700b4105e4)