- Build
frontend
image
docker build -f Dockerfile.dev -t react-ts-temp .
- Run Image
docker run -p 3000:3000 react-ts-temp
- 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.
- Run
dev
orprod
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.
- 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
- Run docker-compose
docker-compose up --build