Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.18 KB

Docker-Cmds.md

File metadata and controls

49 lines (32 loc) · 1.18 KB

Docker Commands

  1. Build frontend image
docker build -f Dockerfile.dev -t react-ts-temp .
  1. Run Image
docker run -p 3000:3000 react-ts-temp
  1. Run Image with Volume Mount
docker run -p 3000:3000 -v /app/node_modules -v "$(pwd):/app" react-ts-temp

If using the -v /app/node_modules flag, you don't need to install node_modules folder. It means that not to take reference for node_modules in the actual directory.

  1. Run dev or prod using docker-compose
docker-compose up --build dev     # run only dev   
docker-compose up --build prod    # run only prod

Remove the --build flag if you don't need to rebuild the image before running it. While running docker-compose the Dockerfile must be in the root directory that contains the src for your code, else it would throw an error.

  1. Run Production build on nginx
docker build -t nish1896/react-ts-temp .

Now run this generated image

docker run -p 8080:80 nish1896/react-ts-temp
  1. Run docker-compose
docker-compose up --build